Angle2 function - Solved


#1

Hello,

I am facing a little bit of problem with Angle2 function. The final list won’t be as expected. I mean for now. This function sort the values from smaller to greater number but does not give me clockwise result or +/- to horizontal. Is there any solution to measure angles other way?

EDIT: I have found answer, I need to use rs.Angle()
or; https://wiki.mcneel.com/developer/scriptsamples/vectorangle

Andras


#2

VectorAngle() will always return a positive value. If all you need is the unsigned angle, that’s fine.

If you need signed angles (indicating rotation direction) between two lines relative to a plane, you can use the Angle() function to get the angle of each line relative to the specified plane (world XY if not specified), then subtract them to get the relative angle.

import rhinoscriptsyntax as rs

line1=rs.coerce3dpoint([10,10,0]),rs.coerce3dpoint([20,15,0])
line2=rs.coerce3dpoint([10,-5,0]),rs.coerce3dpoint([15,-10,0])

ang1=rs.Angle(line1[0],line1[1])
ang2=rs.Angle(line2[0],line2[1])
print ang2[0]-ang1[0]

–Mitch


#3

Thanks Mitch,
Tricky!