PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ _lwt_EdgeRingSignedArea()

static double _lwt_EdgeRingSignedArea ( LWT_EDGERING_POINT_ITERATOR it)
static

Definition at line 6279 of file lwgeom_topo.c.

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

Referenced by _lwt_EdgeRingIsCCW().

6280 {
6281  POINT2D P1;
6282  POINT2D P2;
6283  POINT2D P3;
6284  double sum = 0.0;
6285  double x0, x, y1, y2;
6286 
6287  if ( ! _lwt_EdgeRingIterator_next(it, &P1) ) return 0.0;
6288  if ( ! _lwt_EdgeRingIterator_next(it, &P2) ) return 0.0;
6289 
6290  LWDEBUG(2, "_lwt_EdgeRingSignedArea");
6291 
6292  x0 = P1.x;
6293  while ( _lwt_EdgeRingIterator_next(it, &P3) )
6294  {
6295  x = P2.x - x0;
6296  y1 = P3.y;
6297  y2 = P1.y;
6298  sum += x * (y2-y1);
6299 
6300  /* Move forwards! */
6301  P1 = P2;
6302  P2 = P3;
6303  }
6304 
6305  return sum / 2.0;
6306 }
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
double x
Definition: liblwgeom.h:330
static int _lwt_EdgeRingIterator_next(LWT_EDGERING_POINT_ITERATOR *it, POINT2D *pt)
Definition: lwgeom_topo.c:6046
double y
Definition: liblwgeom.h:330
Here is the call graph for this function:
Here is the caller graph for this function: