top | item 8799628

(no title)

silentvoice | 11 years ago

Very handy formula. I was recently in the situation of being given a bunch of polygons, each represented in a list-of-edges format and I needed to compute the outward-pointing normals for the edges. It's relatively straightforward to translate list-of-edges into list-of-vertices, but not so straightforward (to me) to ensure that the vertices are in counterclockwise order after this translation.

If you take the shoelace formula and remove the absolute value then you still get the correct area up to floating point errors, just there may be a minus sign in front of it. If there is a minus sign, reverse the order of your vertices and boom you have counterclockwise order. Computing the normals after this is routine.

discuss

order

No comments yet.