Fixed the frustum/bound relation.
This commit is contained in:
parent
6691dce420
commit
e0d85820e3
2 changed files with 5 additions and 9 deletions
|
@ -71,15 +71,12 @@ Frustum<S> {
|
||||||
pub fn contains<B: Bound<S>>(&self, bound: &B) -> Relation {
|
pub fn contains<B: Bound<S>>(&self, bound: &B) -> Relation {
|
||||||
[&self.left, &self.right, &self.top, &self.bottom, &self.near, &self.far]
|
[&self.left, &self.right, &self.top, &self.bottom, &self.near, &self.far]
|
||||||
.iter().fold(Relation::In, |cur, p| {
|
.iter().fold(Relation::In, |cur, p| {
|
||||||
|
use std::cmp::max;
|
||||||
let r = bound.relate_plane(p);
|
let r = bound.relate_plane(p);
|
||||||
// if we see Cross, then the result is Cross
|
// If any of the planes are `Out`, the bound is outside.
|
||||||
// if we see In, then we keep the old result
|
// Otherwise, if any are `Cross`, the bound is crossing.
|
||||||
// otherwise, take the current result
|
// Otherwise, the bound is fully inside.
|
||||||
if cur == Relation::Cross || r == Relation::In {
|
max(cur, r)
|
||||||
cur
|
|
||||||
}else {
|
|
||||||
r
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
#![crate_type = "dylib"]
|
#![crate_type = "dylib"]
|
||||||
#![feature(old_impl_check, plugin, core, std_misc, custom_derive)]
|
#![feature(old_impl_check, plugin, core, std_misc, custom_derive)]
|
||||||
#![plugin(rand_macros)]
|
|
||||||
|
|
||||||
//! Computer graphics-centric math.
|
//! Computer graphics-centric math.
|
||||||
//!
|
//!
|
||||||
|
|
Loading…
Reference in a new issue