PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ _lwt_FirstDistinctVertex2D()

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

Definition at line 1428 of file lwgeom_topo.c.

1429 {
1430  int i, toofar, inc;
1431  POINT2D fp;
1432 
1433  if ( dir > 0 )
1434  {
1435  toofar = pa->npoints;
1436  inc = 1;
1437  }
1438  else
1439  {
1440  toofar = -1;
1441  inc = -1;
1442  }
1443 
1444  LWDEBUGF(2, "first point is index %d", from);
1445  fp = *ref; /* getPoint2d_p(pa, from, &fp); */
1446  for ( i = from+inc; i != toofar; i += inc )
1447  {
1448  LWDEBUGF(2, "testing point %d", i);
1449  getPoint2d_p(pa, i, op); /* pick next point */
1450  if ( P2D_SAME_STRICT(op,&fp) ) continue; /* equal to startpoint */
1451  /* this is a good one, neither same of start nor of end point */
1452  return 1; /* found */
1453  }
1454 
1455  /* no distinct vertices found */
1456  return 0;
1457 }
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
Definition: lwgeom_api.c:342
#define P2D_SAME_STRICT(a, b)
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:106
uint32_t npoints
Definition: liblwgeom.h:427

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

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

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