PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ _lwt_FirstDistinctVertex2D()

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

Definition at line 1412 of file lwgeom_topo.c.

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

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

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: