Closed SimonBerens closed 3 years ago
I don't think so, because in polygon.cpp the convention is that a n-sided polygon is representated as a vector of n + 1 vertices where the last vertex equals the first. You can see this at https://github.com/stevenhalim/cpbook-code/blob/6fa2d291848a8da299fde2ebe2baa43478ff42c8/ch7/polygon.cpp#L178-L186
In polygon.cpp I think the shoelace formula is missing the a_n b1 - b_n a_1 term, and in the alternative area function is missing the triangle with vertices O,
P[0]
,P[P.size() -1]
. Am I correct in thinking this?