PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ getPoint3dz_p()

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

Definition at line 332 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(), lwmpoint_extract_points_3d(), lwpoint_getPoint3dz_p(), pt_in_ring_3d(), ptarray_length(), and ptarray_to_SFCGAL().

333 {
334  uint8_t *ptr;
335 
336 #if PARANOIA_LEVEL > 0
337  if ( ! pa ) return 0;
338 
339  if ( (n<0) || (n>=pa->npoints))
340  {
341  LWDEBUGF(4, "%d out of numpoint range (%d)", n, pa->npoints);
342  return 0; /*error */
343  }
344 #endif
345 
346  LWDEBUGF(2, "getPoint3dz_p called on array of %d-dimensions / %u pts",
347  FLAGS_NDIMS(pa->flags), pa->npoints);
348 
349  /* Get a pointer to nth point offset */
350  ptr=getPoint_internal(pa, n);
351 
352  /*
353  * if input POINTARRAY has the Z, it is always
354  * at third position so make a single copy
355  */
356  if ( FLAGS_GET_Z(pa->flags) )
357  {
358  memcpy(op, ptr, sizeof(POINT3DZ));
359  }
360 
361  /*
362  * Otherwise copy the 2d part and initialize
363  * Z to NO_Z_VALUE
364  */
365  else
366  {
367  memcpy(op, ptr, sizeof(POINT2D));
368  op->z=NO_Z_VALUE;
369  }
370 
371  return 1;
372 
373 }
int npoints
Definition: liblwgeom.h:370
uint8_t flags
Definition: liblwgeom.h:368
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:139
#define NO_Z_VALUE
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:151
Here is the call graph for this function:
Here is the caller graph for this function: