PostGIS  2.4.9dev-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 388 of file ptarray.c.

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

Referenced by lwgeom_swap_ordinates().

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