Brush vertices are now checked against all brush planes for validity

This commit is contained in:
Jarrod Doyle 2023-09-18 21:51:21 +01:00
parent a8c7655637
commit e4b6d375f8
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 19 additions and 2 deletions

View File

@ -41,6 +41,8 @@ impl Brush {
return vec![];
}
// Test all permutations of brush planes for intersections
let mut intersections = vec![];
let mut vs = vec![];
let len = self.planes.len();
for i in 0..(len - 2) {
@ -51,13 +53,28 @@ impl Brush {
self.planes[j].plane,
self.planes[k].plane,
) {
// TODO: Validate that the found intersection is within all brush planes
vs.push(intersection.get_intersection_point())
intersections.push(intersection)
}
}
}
}
// Validate intersections against other brush planes
// TODO: No need to check against planes that are part of the intersection
for intersection in intersections {
let mut valid = true;
for bplane in &self.planes {
if !intersection.in_halfspace_mat(&bplane.plane) {
valid = false;
break;
}
}
if valid {
vs.push(intersection.get_intersection_point());
}
}
vs
}
}