PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ ptarray_swap_ordinates()

void ptarray_swap_ordinates ( POINTARRAY pa,
LWORD  o1,
LWORD  o2 
)

Swap ordinate values o1 and o2 on a given POINTARRAY.

Ordinates semantic is: 0=x 1=y 2=z 3=m

Definition at line 387 of file ptarray.c.

References getPoint4d_p(), POINTARRAY::npoints, and ptarray_set_point4d().

Referenced by lwgeom_swap_ordinates().

388 {
389  uint32_t i;
390  double d, *dp1, *dp2;
391  POINT4D p;
392 
393  dp1 = ((double*)&p)+(unsigned)o1;
394  dp2 = ((double*)&p)+(unsigned)o2;
395  for (i=0 ; i < pa->npoints ; i++)
396  {
397  getPoint4d_p(pa, i, &p);
398  d = *dp2;
399  *dp2 = *dp1;
400  *dp1 = d;
401  ptarray_set_point4d(pa, i, &p);
402  }
403 }
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
Definition: lwgeom_api.c:425
unsigned int uint32_t
Definition: uthash.h:78
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:113
uint32_t npoints
Definition: liblwgeom.h:373
Here is the call graph for this function:
Here is the caller graph for this function: