|
![](/i/fill.gif) |
the angle function
#macro _clamp(a,n,m)
#local result = a;
#if (a < n) #local result = n; #end
#if (a > m) #local result = m; #end
result
#end
#macro radang2(A,B)
#declare result =
acos(_clamp(vdot(vnormalize(A),vnormalize(B)), -1.0, 1.0));
result
#end
#macro radang3(A,B,C)
// input is 3 points in 3D -- points to A and C, angle at B
#declare result =
acos(_clamp(vdot(vnormalize(A-B),vnormalize(C-B)), -1.0, 1.0));
result
#end
parameter range for acos() is -1 to 1, _clamp handles user input error.
angle of 2 vectors:
#if (degrees(radang2(nA,nB)) < "somenumber") add nB to tally for this vert(nA),
normalize.
Post a reply to this message
|
![](/i/fill.gif) |