I want to compute the angle between two edges in a face in 3D space.
I thought I could used the solution in this question: Signed angle between two 3D vectors with same origin within the same plane
However, when I try it out on rectangle with all 90 degree angles I get one angle that's 90 degrees and three that's 270.
I have very little knowledge of math related to geometry, which is why I struggle with this and clearly made the wrong assumption.
So how do you calculate the angle between two edges in a face?
What I tried:
def self.full_angle_between( vector1, vector2, normal )
angle = vector1.angle_between( vector2 )
direction = normal % ( vector1 * vector2 )
angle = 360.degrees - angle if direction < 0.0
angle
end
normal
is the face normal
vector1
and vector2
both origins from the same vertex and each points towards the next vertex in either direction
vector1.angle_between( vector2 )
refer to a method in the SketchUp Rubu API: http://code.google.com/apis/sketchup/docs/ourdoc/vector3d.html#angle_between
It return an angle between 0-180 in radians.
360.degrees
yields the degrees in radians. Also an SketchUp API method.
When I iterate over all the vertices in a rectangle I get three angles reported as 270 degrees. Why?