PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ getPoint3dz_p()

int getPoint3dz_p ( const POINTARRAY pa,
int  n,
POINT3DZ point 
)

Definition at line 319 of file lwgeom_api.c.

References POINTARRAY::flags, FLAGS_GET_Z, FLAGS_NDIMS, getPoint_internal(), LWDEBUGF, NO_Z_VALUE, POINTARRAY::npoints, and POINT3DZ::z.

Referenced by BOX3D_construct(), define_plane(), getPoint3dz(), lw_dist3d_point_line(), lw_dist3d_point_point(), lw_dist3d_point_poly(), lw_dist3d_pt_ptarray(), lw_dist3d_ptarray_poly(), lw_dist3d_ptarray_ptarray(), LWGEOM_z_point(), lwline_measured_from_lwline(), lwpoint_getPoint3dz_p(), pt_in_ring_3d(), ptarray_length(), and ptarray_to_SFCGAL().

320 {
321  uint8_t *ptr;
322 
323 #if PARANOIA_LEVEL > 0
324  if ( ! pa ) return 0;
325 
326  if ( (n<0) || (n>=pa->npoints))
327  {
328  LWDEBUGF(4, "%d out of numpoint range (%d)", n, pa->npoints);
329  return 0; /*error */
330  }
331 #endif
332 
333  LWDEBUGF(2, "getPoint3dz_p called on array of %d-dimensions / %u pts",
334  FLAGS_NDIMS(pa->flags), pa->npoints);
335 
336  /* Get a pointer to nth point offset */
337  ptr=getPoint_internal(pa, n);
338 
339  /*
340  * if input POINTARRAY has the Z, it is always
341  * at third position so make a single copy
342  */
343  if ( FLAGS_GET_Z(pa->flags) )
344  {
345  memcpy(op, ptr, sizeof(POINT3DZ));
346  }
347 
348  /*
349  * Otherwise copy the 2d part and initialize
350  * Z to NO_Z_VALUE
351  */
352  else
353  {
354  memcpy(op, ptr, sizeof(POINT2D));
355  op->z=NO_Z_VALUE;
356  }
357 
358  return 1;
359 
360 }
int npoints
Definition: liblwgeom.h:355
uint8_t flags
Definition: liblwgeom.h:353
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1706
#define FLAGS_GET_Z(flags)
Macros for manipulating the &#39;flags&#39; byte.
Definition: liblwgeom.h:124
#define NO_Z_VALUE
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:136
Here is the call graph for this function:
Here is the caller graph for this function: