summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-04-07 15:13:26 -0400
committerTavian Barnes <tavianator@gmail.com>2010-04-07 15:13:26 -0400
commit03c4f1bb394e6d0bee61a438937e068ccf57e09d (patch)
tree94eab86ba5f2d350dfe304e4bf3568be6a6577c0
parent2b087cb45ae91f90492a935625570d7d42ee3ecb (diff)
downloaddimension-03c4f1bb394e6d0bee61a438937e068ccf57e09d.tar.xz
Calculate CSG bounding boxes more accurately.
-rw-r--r--libdimension/csg.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/libdimension/csg.c b/libdimension/csg.c
index 6342432..24f1f80 100644
--- a/libdimension/csg.c
+++ b/libdimension/csg.c
@@ -235,8 +235,8 @@ dmnsn_new_csg_intersection(dmnsn_object *A, dmnsn_object *B)
= dmnsn_matrix_bounding_box_mul(A->trans, A->bounding_box);
dmnsn_bounding_box Bbox
= dmnsn_matrix_bounding_box_mul(B->trans, B->bounding_box);
- csg->bounding_box.min = dmnsn_vector_min(Abox.min, Bbox.min);
- csg->bounding_box.max = dmnsn_vector_max(Abox.max, Bbox.max);
+ csg->bounding_box.min = dmnsn_vector_max(Abox.min, Bbox.min);
+ csg->bounding_box.max = dmnsn_vector_min(Abox.max, Bbox.max);
return csg;
}
@@ -349,13 +349,7 @@ dmnsn_new_csg_difference(dmnsn_object *A, dmnsn_object *B)
csg->intersection_fn = &dmnsn_csg_difference_intersection_fn;
csg->inside_fn = &dmnsn_csg_difference_inside_fn;
csg->free_fn = &dmnsn_csg_free_fn;
-
- dmnsn_bounding_box Abox
- = dmnsn_matrix_bounding_box_mul(A->trans, A->bounding_box);
- dmnsn_bounding_box Bbox
- = dmnsn_matrix_bounding_box_mul(B->trans, B->bounding_box);
- csg->bounding_box.min = dmnsn_vector_min(Abox.min, Bbox.min);
- csg->bounding_box.max = dmnsn_vector_max(Abox.max, Bbox.max);
+ csg->bounding_box = dmnsn_matrix_bounding_box_mul(A->trans, A->bounding_box);
return csg;
}