PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ ptarray_reverse_in_place()

void ptarray_reverse_in_place ( POINTARRAY pa)

Definition at line 339 of file ptarray.c.

340 {
341  if (!pa->npoints)
342  return;
343  uint32_t i;
344  uint32_t last = pa->npoints - 1;
345  uint32_t 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 }
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:194
lwflags_t flags
Definition: liblwgeom.h:446
uint32_t npoints
Definition: liblwgeom.h:442
uint8_t * serialized_pointlist
Definition: liblwgeom.h:449

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: