PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ ptarray_reverse_in_place()

void ptarray_reverse_in_place ( POINTARRAY pa)

Definition at line 331 of file ptarray.c.

332 {
333  if (!pa->npoints)
334  return;
335  uint32_t i;
336  uint32_t last = pa->npoints - 1;
337  uint32_t mid = pa->npoints / 2;
338 
339  double *d = (double*)(pa->serialized_pointlist);
340  int j;
341  int ndims = FLAGS_NDIMS(pa->flags);
342  for (i = 0; i < mid; i++)
343  {
344  for (j = 0; j < ndims; j++)
345  {
346  double buf;
347  buf = d[i*ndims+j];
348  d[i*ndims+j] = d[(last-i)*ndims+j];
349  d[(last-i)*ndims+j] = buf;
350  }
351  }
352  return;
353 }
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:193
lwflags_t flags
Definition: liblwgeom.h:417
uint32_t npoints
Definition: liblwgeom.h:413
uint8_t * serialized_pointlist
Definition: liblwgeom.h:420

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().

Here is the caller graph for this function: