PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ ptarray_locate_along()

static POINTARRAY * ptarray_locate_along ( const POINTARRAY pa,
double  m,
double  offset 
)
static

Definition at line 78 of file lwlinearreferencing.c.

79{
80 uint32_t i;
81 POINT4D p1, p2, pn;
82 POINTARRAY *dpa = NULL;
83
84 /* Can't do anything with degenerate point arrays */
85 if (!pa || pa->npoints < 2)
86 return NULL;
87
88 /* Walk through each segment in the point array */
89 for (i = 1; i < pa->npoints; i++)
90 {
91 getPoint4d_p(pa, i - 1, &p1);
92 getPoint4d_p(pa, i, &p2);
93
94 /* No derived point? Move to next segment. */
95 if (segment_locate_along(&p1, &p2, m, offset, &pn) == LW_FALSE)
96 continue;
97
98 /* No pointarray, make a fresh one */
99 if (dpa == NULL)
101
102 /* Add our new point to the array */
103 ptarray_append_point(dpa, &pn, 0);
104 }
105
106 return dpa;
107}
#define LW_FALSE
Definition liblwgeom.h:94
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition ptarray.c:59
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition lwgeom_api.c:125
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
Definition ptarray.c:147
int ptarray_has_z(const POINTARRAY *pa)
Definition ptarray.c:37
int ptarray_has_m(const POINTARRAY *pa)
Definition ptarray.c:44
static int segment_locate_along(const POINT4D *p1, const POINT4D *p2, double m, double offset, POINT4D *pn)
uint32_t npoints
Definition liblwgeom.h:427

References getPoint4d_p(), LW_FALSE, POINTARRAY::npoints, ptarray_append_point(), ptarray_construct_empty(), ptarray_has_m(), ptarray_has_z(), and segment_locate_along().

Referenced by lwline_locate_along().

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