PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ _lwt_FirstDistinctVertex2D()

static int _lwt_FirstDistinctVertex2D ( const POINTARRAY pa,
POINT2D ref,
int  from,
int  dir,
POINT2D op 
)
static

Definition at line 1395 of file lwgeom_topo.c.

1396 {
1397  int i, toofar, inc;
1398  POINT2D fp;
1399 
1400  if ( dir > 0 )
1401  {
1402  toofar = pa->npoints;
1403  inc = 1;
1404  }
1405  else
1406  {
1407  toofar = -1;
1408  inc = -1;
1409  }
1410 
1411  LWDEBUGF(1, "first point is index %d", from);
1412  fp = *ref; /* getPoint2d_p(pa, from, &fp); */
1413  for ( i = from+inc; i != toofar; i += inc )
1414  {
1415  LWDEBUGF(1, "testing point %d", i);
1416  getPoint2d_p(pa, i, op); /* pick next point */
1417  if ( p2d_same(op, &fp) ) continue; /* equal to startpoint */
1418  /* this is a good one, neither same of start nor of end point */
1419  return 1; /* found */
1420  }
1421 
1422  /* no distinct vertices found */
1423  return 0;
1424 }
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
Definition: lwgeom_api.c:348
int p2d_same(const POINT2D *p1, const POINT2D *p2)
Definition: lwalgorithm.c:49
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
uint32_t npoints
Definition: liblwgeom.h:374

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

Referenced by _lwt_AddEdge(), _lwt_FindAdjacentEdges(), and _lwt_InitEdgeEndByLine().

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