2 ms·
Shoelace Formula
- robinhoodexe 12y agoSort of unrelated: reading Wikipedias mobile pages on a "standard" (15" in my case) screen is actually rather nice. Very clean look.
- percept 12y agoOh, that is nice--think I'll start heading there by default (https://en.m.wikipedia.org/wiki/Main_Page https://en.m.wikipedia.org/wiki/Main_Page).
- silentvoice 12y agoVery 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.