!********************************************************** !* BASIC GEOMETRY MODULE drcur( REF id >"@t8 ID of curve to analyze !"; FLOAT scale:=1; ! Length of lines INT np:=100); ! Number of lines !* Shows curvature variation along a curve. !* !* (C)Microform AB 2000-03-19 J.Kjellander !* !********************************************************** CONSTANT INT MAXPOINTS=1000; VECTOR p1,p2; FLOAT t,kappa(0:MAXPOINTS),kappamax,dl,l,maxlength,cl; INT i,font,ns_geo,ns_gra; BEGINMODULE id:=global_ref(id,1); getcurh(id,font,dl,ns_geo,ns_gra); !* !***Errorcheck. !* if np > MAXPOINTS then np:=MAXPOINTS; endif; !* !***Loop along the curve and calculate kappa. !* cl:=arcl(id); dl:=cl/np; for i:=0 to np do t:=inv_arcl(id,i*dl); kappa(i):=curv(id,t); endfor; !* !***Determine max value of kappa. !* kappamax:=0.0; for i:=0 to np do if kappa(i) > kappamax then kappamax:=kappa(i); endif; endfor; !* !***Display. !* maxlength:=scale*cl; for i:=0 to np do t:=inv_arcl(id,i*dl); p1:=on(id,t); p2:=centre(id,t); if kappa(i) > 0.0 then l:=maxlength*(kappa(i)/kappamax); if l > 0.01 then lin_free(#2,p1,p1+l*vecn(p2-p1):PEN=4); endif; endif; endfor; ENDMODULE