34 #define xstr(s) str(s)
40 static char *ptr = NULL;
56 if (d > (
double)FLT_MAX)
58 if (d <= (
double)-FLT_MAX)
62 if ( ((
double)
result) <=d )
65 return nextafterf(
result, -1*FLT_MAX);
77 if (d >= (
double)FLT_MAX)
79 if (d < (
double)-FLT_MAX)
83 if ( ((
double)
result) >=d )
86 return nextafterf(
result, FLT_MAX);
111 lwerror(
"%s [%d] error returned by getPoint4d_p", __FILE__, __LINE__);
132 lwerror(
"%s [%d] NULL POINTARRAY input", __FILE__, __LINE__);
138 lwerror(
"%s [%d] called with n=%d and npoints=%d", __FILE__, __LINE__, n, pa->
npoints);
142 LWDEBUG(4,
"getPoint4d_p called.");
148 LWDEBUGF(4,
"ptr %p, zmflag %d", ptr, zmflag);
153 memcpy(op, ptr,
sizeof(
POINT2D));
159 memcpy(op, ptr,
sizeof(
POINT4D));
221 lwerror(
"%s [%d] NULL POINTARRAY input", __FILE__, __LINE__);
228 lwnotice(
"%s [%d] called with n=%d and npoints=%d", __FILE__, __LINE__, n, pa->
npoints);
232 LWDEBUGF(2,
"getPoint3dz_p called on array of %d-dimensions / %u pts",
253 memcpy(op, ptr,
sizeof(
POINT2D));
275 lwerror(
"%s [%d] NULL POINTARRAY input", __FILE__, __LINE__);
281 lwerror(
"%s [%d] called with n=%d and npoints=%d", __FILE__, __LINE__, n, pa->
npoints);
303 memcpy(op, ptr,
sizeof(
POINT2D));
313 memcpy(&(op->
m), ptr,
sizeof(
double));
346 lwerror(
"%s [%d] NULL POINTARRAY input", __FILE__, __LINE__);
352 lwnotice(
"%s [%d] called with n=%d and npoints=%d", __FILE__, __LINE__, n, pa->
npoints);
372 assert(n < pa->npoints);
377 memcpy(ptr, p4d,
sizeof(
POINT4D));
383 memcpy(ptr, p4d,
sizeof(
POINT2D));
385 memcpy(ptr, &(p4d->
m),
sizeof(
double));
388 memcpy(ptr, p4d,
sizeof(
POINT2D));
422 lwerror(
"%s: unsupported number of dimensions - %d", __func__, ndims);
448 lwnotice(
" PTARRAY is null pointer!");
459 for (t = 0; t < pa->
npoints; t++)
465 lwnotice(
" %i : %lf,%lf,%lf", t, pt.
x, pt.
y, pt.
z);
467 lwnotice(
" %i : %lf,%lf,%lf,%lf", t, pt.
x, pt.
y, pt.
z, pt.
m);
483 uint8_t result_high = 0;
484 uint8_t result_low = 0;
600 return (uint8_t) ((result_high<<4) + result_low);
618 static char outchr[]=
623 input_high = (
str>>4);
624 input_low = (
str & 0x0F);
626 result[0] = outchr[input_high];
627 result[1] = outchr[input_low];
648 assert(F >= 0 && F <= 1);
649 I->
x=A->
x+((B->
x-A->
x)*F);
650 I->
y=A->
y+((B->
y-A->
y)*F);
651 I->
z=A->
z+((B->
z-A->
z)*F);
652 I->
m=A->
m+((B->
m-A->
m)*F);
char result[OUT_DOUBLE_BUFFER_SIZE]
#define LIBLWGEOM_VERSION
liblwgeom versions
void() lwinterrupt_callback(void)
Install a callback to be called periodically during algorithm execution.
#define FLAGS_GET_Z(flags)
#define FLAGS_NDIMS(flags)
#define FLAGS_GET_M(flags)
#define FLAGS_GET_ZM(flags)
#define LW_TRUE
Return types for functions with status returns.
void deparse_hex(uint8_t str, char *result)
Given one byte, populate result with two byte representing the hex number.
POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n)
lwinterrupt_callback * _lwgeom_interrupt_callback
const char * lwgeom_version()
Return lwgeom version string (not to be freed)
void lwgeom_cancel_interrupt()
Cancel any interruption request.
void interpolate_point4d(const POINT4D *A, const POINT4D *B, POINT4D *I, double F)
Find interpolation point I between point A and point B so that the len(AI) == len(AB)*F and I falls o...
POINT3DM getPoint3dm(const POINTARRAY *pa, uint32_t n)
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *op)
int _lwgeom_interrupt_requested
void printPA(POINTARRAY *pa)
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
void printBOX3D(BOX3D *box)
void lwgeom_request_interrupt()
Request interruption of any running code.
lwinterrupt_callback * lwgeom_register_interrupt_callback(lwinterrupt_callback *cb)
POINT3DZ getPoint3dz(const POINTARRAY *pa, uint32_t n)
POINT2D getPoint2d(const POINTARRAY *pa, uint32_t n)
uint8_t parse_hex(char *str)
Given a string with at least 2 chars in it, convert them to a byte value.
float next_float_up(double d)
int getPoint3dm_p(const POINTARRAY *pa, uint32_t n, POINT3DM *op)
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
void ptarray_copy_point(POINTARRAY *pa, uint32_t from, uint32_t to)
float next_float_down(double d)
int getPoint3dz_p(const POINTARRAY *pa, uint32_t n, POINT3DZ *op)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
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 const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
static size_t ptarray_point_size(const POINTARRAY *pa)
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)