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

◆ gidx_inter_volume()

static float gidx_inter_volume ( GIDX *  a,
GIDX *  b 
)
static

Definition at line 340 of file gserialized_gist_nd.c.

341{
342 uint32_t i;
343 float result;
344
345 POSTGIS_DEBUG(5, "entered function");
346
347 if (!a || !b)
348 {
349 elog(ERROR, "gidx_inter_volume received a null argument");
350 return 0.0;
351 }
352
353 if (gidx_is_unknown(a) || gidx_is_unknown(b))
354 return 0.0;
355
356 /* Ensure 'a' has the most dimensions. */
358
359 /* Initialize with minimal length of first dimension. */
360 result = Min(GIDX_GET_MAX(a, 0), GIDX_GET_MAX(b, 0)) - Max(GIDX_GET_MIN(a, 0), GIDX_GET_MIN(b, 0));
361
362 /* If they are disjoint (max < min) then return zero. */
363 if (result < 0.0)
364 return 0.0;
365
366 /* Continue for remaining dimensions. */
367 for (i = 1; i < GIDX_NDIMS(b); i++)
368 {
369 float width = Min(GIDX_GET_MAX(a, i), GIDX_GET_MAX(b, i)) - Max(GIDX_GET_MIN(a, i), GIDX_GET_MIN(b, i));
370 if (width < 0.0)
371 return 0.0;
372 /* Multiply by minimal length of remaining dimensions. */
373 result *= width;
374 }
375 POSTGIS_DEBUGF(5, "volume( %s intersection %s ) = %.12g", gidx_to_string(a), gidx_to_string(b), result);
376 return result;
377}
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition cu_print.c:267
bool gidx_is_unknown(const GIDX *a)
static void gidx_dimensionality_check(GIDX **a, GIDX **b)

References gidx_dimensionality_check(), gidx_is_unknown(), and result.

Referenced by gserialized_gist_picksplit_constructsplit().

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