diff --git a/src/frustum.rs b/src/frustum.rs index 2dc6c1d..e9e4468 100644 --- a/src/frustum.rs +++ b/src/frustum.rs @@ -71,15 +71,12 @@ Frustum { pub fn contains>(&self, bound: &B) -> Relation { [&self.left, &self.right, &self.top, &self.bottom, &self.near, &self.far] .iter().fold(Relation::In, |cur, p| { + use std::cmp::max; let r = bound.relate_plane(p); - // if we see Cross, then the result is Cross - // if we see In, then we keep the old result - // otherwise, take the current result - if cur == Relation::Cross || r == Relation::In { - cur - }else { - r - } + // If any of the planes are `Out`, the bound is outside. + // Otherwise, if any are `Cross`, the bound is crossing. + // Otherwise, the bound is fully inside. + max(cur, r) }) } } diff --git a/src/lib.rs b/src/lib.rs index c0c7df8..f1eb8ef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,7 +16,6 @@ #![crate_type = "rlib"] #![crate_type = "dylib"] #![feature(old_impl_check, plugin, core, std_misc, custom_derive)] -#![plugin(rand_macros)] //! Computer graphics-centric math. //!