PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ ptarray_reverse_in_place()

void ptarray_reverse_in_place ( POINTARRAY pa)

Definition at line 341 of file ptarray.c.

References POINTARRAY::flags, FLAGS_NDIMS, POINTARRAY::npoints, and POINTARRAY::serialized_pointlist.

Referenced by _lwt_HealEdges(), _lwt_MakeRingShell(), lwgeom_reverse_in_place(), lwpoly_force_clockwise(), and lwtriangle_force_clockwise().

342 {
343  int i;
344  int last = pa->npoints-1;
345  int mid = pa->npoints/2;
346 
347  double *d = (double*)(pa->serialized_pointlist);
348  int j;
349  int ndims = FLAGS_NDIMS(pa->flags);
350  for (i = 0; i < mid; i++)
351  {
352  for (j = 0; j < ndims; j++)
353  {
354  double buf;
355  buf = d[i*ndims+j];
356  d[i*ndims+j] = d[(last-i)*ndims+j];
357  d[(last-i)*ndims+j] = buf;
358  }
359  }
360  return;
361 }
uint8_t * serialized_pointlist
Definition: liblwgeom.h:368
uint8_t flags
Definition: liblwgeom.h:371
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:151
uint32_t npoints
Definition: liblwgeom.h:373
Here is the caller graph for this function: