Skip to content

Commit

Permalink
Using real bbox dimensions for octree search
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel committed Nov 29, 2018
1 parent 74b8e97 commit 1d41a6c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
18 changes: 18 additions & 0 deletions rGWB/csmbbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,24 @@ CSMBOOL csmbbox_contains_point(const struct csmbbox_t *bbox, double x, double y,

// ------------------------------------------------------------------------------------------

CSMBOOL csmbbox_contains_point_in_real_dimensions(const struct csmbbox_t *bbox, double x, double y, double z)
{
assert_no_null(bbox);

if (x < bbox->x_min || x > bbox->x_max)
return CSMFALSE;

if (y < bbox->y_min || y > bbox->y_max)
return CSMFALSE;

if (z < bbox->z_min || z > bbox->z_max)
return CSMFALSE;

return CSMTRUE;
}

// ------------------------------------------------------------------------------------------

static CSMBOOL i_exists_intersection_between_bbboxes(
double x_min1, double y_min1, double z_min1, double x_max1, double y_max1, double z_max1,
double x_min2, double y_min2, double z_min2, double x_max2, double y_max2, double z_max2)
Expand Down
2 changes: 2 additions & 0 deletions rGWB/csmbbox.inl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ void csmbbox_get_extension_ext(

CSMBOOL csmbbox_contains_point(const struct csmbbox_t *bbox, double x, double y, double z);

CSMBOOL csmbbox_contains_point_in_real_dimensions(const struct csmbbox_t *bbox, double x, double y, double z);

CSMBOOL csmbbox_intersects_with_other_bbox(const struct csmbbox_t *bbox1, const struct csmbbox_t *bbox2);

CSMBOOL csmbbox_intersects_with_segment(
Expand Down
2 changes: 1 addition & 1 deletion rGWB/csmfacbrep2solid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ static void i_append_face_loop_points_to_octree_bbox(const struct csmfacbrep2sol
static CSMBOOL i_is_vertex_contained_in_bbox(const struct i_vertex_t *vertex, const struct csmbbox_t *bbox)
{
assert_no_null(vertex);
return csmbbox_contains_point(bbox, vertex->x, vertex->y, vertex->z);
return csmbbox_contains_point_in_real_dimensions(bbox, vertex->x, vertex->y, vertex->z);
}

// ------------------------------------------------------------------------------------------
Expand Down
8 changes: 5 additions & 3 deletions rGWB/csmtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -6360,9 +6360,11 @@ void csmtest_test(void)

csmdebug_set_treat_improper_solid_operations_as_errors(CSMTRUE);

i_test_importacion_stl1();
i_test_facetedbrep1(viewer);
i_test_facetedbrep2(viewer, CSMTRUE);
//i_test_importacion_stl1();
//i_test_importacion_stl2();
i_test_importacion_stl3();
//i_test_facetedbrep1(viewer);
//i_test_facetedbrep2(viewer, CSMTRUE);

csmdebug_set_treat_improper_solid_operations_as_errors(CSMFALSE);
i_test_facetedbrep2(viewer, CSMFALSE);
Expand Down
4 changes: 2 additions & 2 deletions rGWB/csmtest_octree.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static void i_free_point(struct i_point_t **point)
static CSMBOOL i_is_point_in_bbox(const struct i_point_t *point, const struct csmbbox_t *bbox)
{
assert_no_null(point);
return csmbbox_contains_point(bbox, point->x, point->y, point->z);
return csmbbox_contains_point_in_real_dimensions(bbox, point->x, point->y, point->z);
}

// ----------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -172,6 +172,6 @@ static void i_test2(void)

void csmtest_octree_test(void)
{
//i_test1();
i_test1();
i_test2();
}

0 comments on commit 1d41a6c

Please sign in to comment.