PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ptarray_locate_along_linear()

static int ptarray_locate_along_linear ( const POINTARRAY pa,
double  m,
POINT4D p,
uint32_t  from 
)
static

Definition at line 1056 of file lwlinearreferencing.c.

1057 {
1058  uint32_t i = from;
1059  POINT4D p1, p2;
1060 
1061  /* Walk through each segment in the point array */
1062  getPoint4d_p(pa, i, &p1);
1063  for ( i = from+1; i < pa->npoints; i++ )
1064  {
1065  getPoint4d_p(pa, i, &p2);
1066 
1067  if ( segment_locate_along(&p1, &p2, m, 0, p) == LW_TRUE )
1068  return i-1; /* found */
1069 
1070  p1 = p2;
1071  }
1072 
1073  return -1; /* not found */
1074 }
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:123
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
static int segment_locate_along(const POINT4D *p1, const POINT4D *p2, double m, double offset, POINT4D *pn)
uint32_t npoints
Definition: liblwgeom.h:374
unsigned int uint32_t
Definition: uthash.h:78

References getPoint4d_p(), LW_TRUE, POINTARRAY::npoints, and segment_locate_along().

Referenced by lwgeom_cpa_within(), and lwgeom_tcpa().

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