PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ ptarray_reverse()

void ptarray_reverse ( POINTARRAY pa)

Definition at line 343 of file ptarray.c.

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

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

344 {
345  /* TODO change this to double array operations once point array is double aligned */
346  POINT4D pbuf;
347  uint32_t i;
348  int ptsize = ptarray_point_size(pa);
349  int last = pa->npoints-1;
350  int mid = pa->npoints/2;
351 
352  for (i=0; i<mid; i++)
353  {
354  uint8_t *from, *to;
355  from = getPoint_internal(pa, i);
356  to = getPoint_internal(pa, (last-i));
357  memcpy((uint8_t *)&pbuf, to, ptsize);
358  memcpy(to, from, ptsize);
359  memcpy(from, (uint8_t *)&pbuf, ptsize);
360  }
361 
362 }
int ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:54
int npoints
Definition: liblwgeom.h:371
unsigned int uint32_t
Definition: uthash.h:78
unsigned char uint8_t
Definition: uthash.h:79
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1753
Here is the call graph for this function:
Here is the caller graph for this function: