Algorithm "NoObtuse" In Javascript
Algorithm 'NoObtuse' in javascript. I have to implement this algo below in a canvas. The user put a set of points and click on the button to call the function 'noObtuse' and I ha
Solution 1:
To get the first point from the rightmost, choose one with the smallest value of
angle = Math.atan2(P[i].Y - rightmost.Y, P[i].X - rightmost.X)
To get the next point that goes after current A and B points in CCW order, you can compare angles A-B-C, calculated through atan2, cross-product and dot product of vectors.
angle = Math.atan2(cross(AB, BC), dot(AB, BC))
Post a Comment for "Algorithm "NoObtuse" In Javascript"