PostGIS  2.2.7dev-r@@SVN_REVISION@@
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 #if PARANOIA_LEVEL > 0
395  assert(o1 < 4);
396  assert(o2 < 4);
397 #endif
398 
399  dp1 = ((double*)&p)+(unsigned)o1;
400  dp2 = ((double*)&p)+(unsigned)o2;
401  for (i=0 ; i < pa->npoints ; i++)
402  {
403  getPoint4d_p(pa, i, &p);
404  d = *dp2;
405  *dp2 = *dp1;
406  *dp1 = d;
407  ptarray_set_point4d(pa, i, &p);
408  }
409 }
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
Definition: lwgeom_api.c:536
int npoints
Definition: liblwgeom.h:355
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: