!********************************************************** !* BASIC GEOMETRY MODULE drcur( REF id >"@t8 ID of curve to analyze !"; FLOAT scale:=1; INT np:=100); !* Shows curvature variation. !* !********************************************************** CONSTANT INT MAXPOINTS=1000; VECTOR p1,p2; FLOAT t,kappa(0:MAXPOINTS),kappamax,dl,l,maxlength; 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. !* for i:=0 to np do t:=i/np*ns_geo; 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*arcl(id); for i:=0 to np do t:=i/np*ns_geo; 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