summaryrefslogtreecommitdiffstats
path: root/libdimension/geometry.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-04-15 15:15:39 -0400
committerTavian Barnes <tavianator@gmail.com>2010-04-15 15:15:39 -0400
commit1b1f00e70564d6acb2b1e09b0a5f430da4e4b8a3 (patch)
treeccf2628596a9ac7a1d2fed71f048d7427576a737 /libdimension/geometry.c
parent3037c067f2937b68bfd0c7f906f7e7ecadd4b8d5 (diff)
downloaddimension-1b1f00e70564d6acb2b1e09b0a5f430da4e4b8a3.tar.xz
Support infinitely large bounding boxes.
Diffstat (limited to 'libdimension/geometry.c')
-rw-r--r--libdimension/geometry.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libdimension/geometry.c b/libdimension/geometry.c
index 7dc6725..304f21d 100644
--- a/libdimension/geometry.c
+++ b/libdimension/geometry.c
@@ -363,6 +363,15 @@ dmnsn_matrix_vector_mul(dmnsn_matrix lhs, dmnsn_vector rhs)
dmnsn_bounding_box
dmnsn_matrix_bounding_box_mul(dmnsn_matrix trans, dmnsn_bounding_box box)
{
+ /* Infinite bounding box support */
+ if (isinf(box.min.x) || isinf(box.min.y) || isinf(box.min.z)
+ || isinf(box.max.x) || isinf(box.max.y) || isinf(box.max.z))
+ {
+ box.min = dmnsn_new_vector(-INFINITY, -INFINITY, -INFINITY);
+ box.max = dmnsn_new_vector(INFINITY, INFINITY, INFINITY);
+ return box;
+ }
+
dmnsn_vector corner;
dmnsn_bounding_box ret;
ret.min = dmnsn_matrix_vector_mul(trans, box.min);