PostGIS  2.1.10dev-r@@SVN_REVISION@@
void ptarray_reverse ( POINTARRAY pa)

Definition at line 328 of file ptarray.c.

References getPoint_internal(), POINTARRAY::npoints, and ptarray_point_size().

Referenced by lwcircstring_reverse(), lwline_reverse(), lwpoly_force_clockwise(), lwpoly_reverse(), lwtriangle_force_clockwise(), and lwtriangle_reverse().

329 {
330  /* TODO change this to double array operations once point array is double aligned */
331  POINT4D pbuf;
332  uint32_t i;
333  int ptsize = ptarray_point_size(pa);
334  int last = pa->npoints-1;
335  int mid = pa->npoints/2;
336 
337  for (i=0; i<mid; i++)
338  {
339  uint8_t *from, *to;
340  from = getPoint_internal(pa, i);
341  to = getPoint_internal(pa, (last-i));
342  memcpy((uint8_t *)&pbuf, to, ptsize);
343  memcpy(to, from, ptsize);
344  memcpy(from, (uint8_t *)&pbuf, ptsize);
345  }
346 
347 }
int ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:41
int npoints
Definition: liblwgeom.h:327
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1645

Here is the call graph for this function:

Here is the caller graph for this function: