Add alternative brush to brush plane intersection methods

This commit is contained in:
Jarrod Doyle 2023-10-12 12:03:06 +01:00
parent 4281db12c8
commit c8d9480593
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 40 additions and 0 deletions

View File

@ -89,6 +89,46 @@ impl Brush {
false false
} }
pub fn planes_intersect_with_mat(&self, other: &Brush) -> bool {
// Check our vertices against their planes
for i in &self.raw_vertices {
let mut iter = other.planes.iter();
if iter.all(|bp| i.in_halfspace_mat(&bp.plane)) {
return true;
}
}
// Check their vertices against our planes
for i in &other.raw_vertices {
let mut iter = self.planes.iter();
if iter.all(|bp| i.in_halfspace_mat(&bp.plane)) {
return true;
}
}
false
}
pub fn planes_intersect_with_gauss(&self, other: &Brush) -> bool {
// Check our vertices against their planes
for i in &self.raw_vertices {
let mut iter = other.planes.iter();
if iter.all(|bp| i.in_halfspace_gauss(&bp.plane)) {
return true;
}
}
// Check their vertices against our planes
for i in &other.raw_vertices {
let mut iter = self.planes.iter();
if iter.all(|bp| i.in_halfspace_gauss(&bp.plane)) {
return true;
}
}
false
}
pub fn get_vertices(&self) -> Vec<Vec3> { pub fn get_vertices(&self) -> Vec<Vec3> {
self.vertices.clone() self.vertices.clone()
} }