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 {
|
||||
// TODO: Benchmark this
|
||||
// Check our vertices against their planes
|
||||
for pi in &self.raw_vertices {
|
||||
if other.planes.iter().all(|bp| pi.in_halfspace_mat(&bp.plane)) {
|
||||
for v in &self.vertices {
|
||||
let mut iter = other.planes.iter();
|
||||
if iter.all(|bp| bp.plane.point_in_halfspace(*v)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Check their vertices against our planes
|
||||
for pi in &other.raw_vertices {
|
||||
if self.planes.iter().all(|bp| pi.in_halfspace_mat(&bp.plane)) {
|
||||
for v in &other.vertices {
|
||||
let mut iter = self.planes.iter();
|
||||
if iter.all(|bp| bp.plane.point_in_halfspace(*v)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue