javascript - How to compute an angle between 2 vectors in a polygon -
i implemented method in javascript compute angle between 2 vectors. don't know how compute angle lies in polygon.
example, in image want compute red angle in left 1 need go ac ab while in right 1 need ab ac.
thank response
from question understand need values of red (internal) angles. easy them knowing order. ccw order find directed angle between 2 consecutive edge vectors. in first case vectors ba/ac, in second ca/ab
to directed angle in full 2*pi
(360 degrees) range, can use atan2
function
fi_left = atan2 (crossproduct(ba, ac), dotproduct(ba, ac)) fi_right = atan2 (crossproduct(ca, ab), dotproduct(ca, ab))
Comments
Post a Comment