Shoelace formula does not work for a given quadrilateral coordinates

2.8k Views Asked by At

Given 4 points:

(x0, y0) = (0.34,3.79)
(x1, y1) = (1.09,3.69)
(x2, y2) = (0.44,3.79)
(x3, y3) = (1.19,3.69)

According to formula:

a = x0*y1 + x1*y2 + x2*y3 + x3*y0 - (y0*x1 + y1*x2 + y2*x3 + y3*x0)
area = 0.5 * |a|

However, a = 0. Where do I make mistake?

2

There are 2 best solutions below

0
On BEST ANSWER

The points need to be ordered either clockwise or anticlockwise. If you plot out the points in the order you've specified them, you'll see you've started with a diagonal.

0
On

The mistake you made is that the order of the points matter, the polygon that you described with those points look like an "hourglass" (lopsided).