PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ getPoint3dz_p()

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

Definition at line 215 of file lwgeom_api.c.

216{
217 uint8_t *ptr;
218
219 if ( ! pa )
220 {
221 lwerror("%s [%d] NULL POINTARRAY input", __FILE__, __LINE__);
222 return 0;
223 }
224
225 //assert(n < pa->npoints); --causes point empty/point empty to crash
226 if ( n>=pa->npoints )
227 {
228 lwnotice("%s [%d] called with n=%d and npoints=%d", __FILE__, __LINE__, n, pa->npoints);
229 return 0;
230 }
231
232 LWDEBUGF(2, "getPoint3dz_p called on array of %d-dimensions / %u pts",
233 FLAGS_NDIMS(pa->flags), pa->npoints);
234
235 /* Get a pointer to nth point offset */
236 ptr=getPoint_internal(pa, n);
237
238 /*
239 * if input POINTARRAY has the Z, it is always
240 * at third position so make a single copy
241 */
242 if ( FLAGS_GET_Z(pa->flags) )
243 {
244 memcpy(op, ptr, sizeof(POINT3DZ));
245 }
246
247 /*
248 * Otherwise copy the 2d part and initialize
249 * Z to NO_Z_VALUE
250 */
251 else
252 {
253 memcpy(op, ptr, sizeof(POINT2D));
254 op->z=NO_Z_VALUE;
255 }
256
257 return 1;
258
259}
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
#define FLAGS_NDIMS(flags)
Definition liblwgeom.h:179
#define NO_Z_VALUE
#define LWDEBUGF(level, msg,...)
Definition lwgeom_log.h:106
void lwnotice(const char *fmt,...) __attribute__((format(printf
Write a notice out to the notice handler.
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition lwinline.h:75
lwflags_t flags
Definition liblwgeom.h:431
uint32_t npoints
Definition liblwgeom.h:427

References POINTARRAY::flags, FLAGS_GET_Z, FLAGS_NDIMS, getPoint_internal(), LWDEBUGF, lwerror(), lwnotice(), 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_point_tri(), lw_dist3d_pt_ptarray(), lw_dist3d_ptarray_poly(), lw_dist3d_ptarray_ptarray(), lw_dist3d_ptarray_tri(), lwline_measured_from_lwline(), lwpoint_getPoint3dz_p(), pt_in_ring_3d(), and ptarray_length().

Here is the call graph for this function:
Here is the caller graph for this function: