PostGIS  2.2.7dev-r@@SVN_REVISION@@
static int _lwt_FirstDistinctVertex2D ( const POINTARRAY pa,
POINT2D ref,
int  from,
int  dir,
POINT2D op 
)
static

Definition at line 1414 of file lwgeom_topo.c.

References getPoint2d_p(), LWDEBUGF, POINTARRAY::npoints, and p2d_same().

Referenced by _lwt_InitEdgeEndByLine().

1415 {
1416  int i, toofar, inc;
1417  POINT2D fp;
1418 
1419  if ( dir > 0 )
1420  {
1421  toofar = pa->npoints;
1422  inc = 1;
1423  }
1424  else
1425  {
1426  toofar = -1;
1427  inc = -1;
1428  }
1429 
1430  LWDEBUGF(1, "first point is index %d", from);
1431  fp = *ref; /* getPoint2d_p(pa, from, &fp); */
1432  for ( i = from+inc; i != toofar; i += inc )
1433  {
1434  LWDEBUGF(1, "testing point %d", i);
1435  getPoint2d_p(pa, i, op); /* pick next point */
1436  if ( p2d_same(op, &fp) ) continue; /* equal to startpoint */
1437  /* this is a good one, neither same of start nor of end point */
1438  return 1; /* found */
1439  }
1440 
1441  /* no distinct vertices found */
1442  return 0;
1443 }
int npoints
Definition: liblwgeom.h:355
int p2d_same(const POINT2D *p1, const POINT2D *p2)
Definition: lwalgorithm.c:35
int getPoint2d_p(const POINTARRAY *pa, int n, POINT2D *point)
Definition: lwgeom_api.c:448
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55

Here is the call graph for this function:

Here is the caller graph for this function: