PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ ptarray_locate_along_linear()

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

Definition at line 1037 of file lwlinearreferencing.c.

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

Referenced by lwgeom_cpa_within(), and lwgeom_tcpa().

1038 {
1039  int i = from;
1040  POINT4D p1, p2;
1041 
1042  /* Walk through each segment in the point array */
1043  getPoint4d_p(pa, i, &p1);
1044  for ( i = from+1; i < pa->npoints; i++ )
1045  {
1046  getPoint4d_p(pa, i, &p2);
1047 
1048  if ( segment_locate_along(&p1, &p2, m, 0, p) == LW_TRUE )
1049  return i-1; /* found */
1050 
1051  p1 = p2;
1052  }
1053 
1054  return -1; /* not found */
1055 }
int npoints
Definition: liblwgeom.h:355
static int segment_locate_along(const POINT4D *p1, const POINT4D *p2, double m, double offset, POINT4D *pn)
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
Definition: lwgeom_api.c:231
Here is the call graph for this function:
Here is the caller graph for this function: