Remove double transpose
This commit is contained in:
parent
43d5259af2
commit
dc749aa7be
|
@ -68,6 +68,25 @@ impl Brush {
|
||||||
self.aabb.intersects(other.get_aabb())
|
self.aabb.intersects(other.get_aabb())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)) {
|
||||||
|
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)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_vertices(&self) -> Vec<Vec3> {
|
pub fn get_vertices(&self) -> Vec<Vec3> {
|
||||||
self.vertices.clone()
|
self.vertices.clone()
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,11 @@ impl PlaneIntersection {
|
||||||
let d1 = m1.determinant();
|
let d1 = m1.determinant();
|
||||||
|
|
||||||
// We can resolve the winding order problem by multiplying by the normal matrix determinant
|
// We can resolve the winding order problem by multiplying by the normal matrix determinant
|
||||||
let m2 = self.get_matrix().transpose();
|
let m2 = glam::mat3(
|
||||||
|
self.planes[0].normal,
|
||||||
|
self.planes[1].normal,
|
||||||
|
self.planes[2].normal,
|
||||||
|
);
|
||||||
let d2 = m2.determinant();
|
let d2 = m2.determinant();
|
||||||
let dist = d1 * d2;
|
let dist = d1 * d2;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue