Use faster halfspace method for precise brush intersection
This commit is contained in:
parent
dc749aa7be
commit
e1688f6841
|
@ -69,17 +69,18 @@ impl Brush {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn planes_intersect_with(&self, other: &Brush) -> bool {
|
pub fn planes_intersect_with(&self, other: &Brush) -> bool {
|
||||||
// TODO: Benchmark this
|
|
||||||
// Check our vertices against their planes
|
// Check our vertices against their planes
|
||||||
for pi in &self.raw_vertices {
|
for v in &self.vertices {
|
||||||
if other.planes.iter().all(|bp| pi.in_halfspace_mat(&bp.plane)) {
|
let mut iter = other.planes.iter();
|
||||||
|
if iter.all(|bp| bp.plane.point_in_halfspace(*v)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check their vertices against our planes
|
// Check their vertices against our planes
|
||||||
for pi in &other.raw_vertices {
|
for v in &other.vertices {
|
||||||
if self.planes.iter().all(|bp| pi.in_halfspace_mat(&bp.plane)) {
|
let mut iter = self.planes.iter();
|
||||||
|
if iter.all(|bp| bp.plane.point_in_halfspace(*v)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue