Add alternative brush to brush plane intersection methods
This commit is contained in:
parent
4281db12c8
commit
c8d9480593
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue