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

◆ nd_box_ratio_cases()

static void nd_box_ratio_cases ( void  )
static

Definition at line 127 of file postgis/cunit/cu_tester.c.

128{
129 ND_BOX covering = make_box(0.0f, 0.0f, 0.0f, 0.0f, 2.0f, 2.0f, 2.0f, 0.0f);
130 ND_BOX interior = make_box(0.5f, 0.5f, 0.5f, 0.0f, 1.5f, 1.5f, 1.5f, 0.0f);
131 ND_BOX partial = make_box(0.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.5f, 0.5f, 0.0f);
132 ND_BOX target = make_box(0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f);
133 ND_BOX flat = make_box(0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f);
134 ND_BOX touch = make_box(2.0f, 0.0f, 0.0f, 0.0f, 3.0f, 1.0f, 1.0f, 0.0f);
135
136 /* Full coverage should evaluate to one regardless of the extra extent. */
137 CU_ASSERT_DOUBLE_EQUAL(nd_box_ratio(&covering, &interior, 3), 1.0, 1e-12);
138 /* A shared octant carries one eighth of the reference volume. */
139 CU_ASSERT_DOUBLE_EQUAL(nd_box_ratio(&partial, &target, 3), 0.125, 1e-12);
140 /* Degenerate slabs have zero volume in three dimensions. */
141 CU_ASSERT_DOUBLE_EQUAL(nd_box_ratio(&covering, &flat, 3), 0.0, 1e-12);
142 /* Boxes that only touch along a face should not count as overlap. */
143 CU_ASSERT_DOUBLE_EQUAL(nd_box_ratio(&covering, &touch, 3), 0.0, 1e-12);
144}
static double nd_box_ratio(const ND_BOX *cover, const ND_BOX *target, int ndims)
static ND_BOX make_box(float minx, float miny, float minz, float minm, float maxx, float maxy, float maxz, float maxm)

References make_box(), and nd_box_ratio().

Referenced by main().

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