PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ _lwt_EdgeRingSignedArea()

static double _lwt_EdgeRingSignedArea ( LWT_EDGERING_POINT_ITERATOR it)
static

Definition at line 6382 of file lwgeom_topo.c.

6383{
6384 POINT2D P1;
6385 POINT2D P2;
6386 POINT2D P3;
6387 double sum = 0.0;
6388 double x0, x, y1, y2;
6389
6390 if ( ! _lwt_EdgeRingIterator_next(it, &P1) ) return 0.0;
6391 if ( ! _lwt_EdgeRingIterator_next(it, &P2) ) return 0.0;
6392
6393 LWDEBUG(2, "_lwt_EdgeRingSignedArea");
6394
6395 x0 = P1.x;
6396 while ( _lwt_EdgeRingIterator_next(it, &P3) )
6397 {
6398 x = P2.x - x0;
6399 y1 = P3.y;
6400 y2 = P1.y;
6401 sum += x * (y2-y1);
6402
6403 /* Move forwards! */
6404 P1 = P2;
6405 P2 = P3;
6406 }
6407
6408 return sum / 2.0;
6409}
#define LWDEBUG(level, msg)
Definition lwgeom_log.h:83
static int _lwt_EdgeRingIterator_next(LWT_EDGERING_POINT_ITERATOR *it, POINT2D *pt)
double y
Definition liblwgeom.h:376
double x
Definition liblwgeom.h:376

References _lwt_EdgeRingIterator_next(), LWDEBUG, POINT2D::x, and POINT2D::y.

Referenced by _lwt_EdgeRingIsCCW().

Here is the call graph for this function:
Here is the caller graph for this function: