@konstantin wrote:
I’m getting negative values trying to get area of a polyline - the algorithm works fine on paper, but produces negative values when running. Am I missing something fundamental?
// area for(int i=0;i<(int)points.size()-1;i++){ area += points[i].x * points[i+1].y - points[i+1].x * points[i].y; } area += points[points.size()-1].x * points[0].y - points[0].x * points[points.size()-1].y; area *= 0.5;
Posts: 3
Participants: 3