Brush vertices are now checked against all brush planes for validity
This commit is contained in:
		
							parent
							
								
									a8c7655637
								
							
						
					
					
						commit
						e4b6d375f8
					
				|  | @ -41,6 +41,8 @@ impl Brush { | ||||||
|             return vec![]; |             return vec![]; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         // Test all permutations of brush planes for intersections
 | ||||||
|  |         let mut intersections = vec![]; | ||||||
|         let mut vs = vec![]; |         let mut vs = vec![]; | ||||||
|         let len = self.planes.len(); |         let len = self.planes.len(); | ||||||
|         for i in 0..(len - 2) { |         for i in 0..(len - 2) { | ||||||
|  | @ -51,13 +53,28 @@ impl Brush { | ||||||
|                         self.planes[j].plane, |                         self.planes[j].plane, | ||||||
|                         self.planes[k].plane, |                         self.planes[k].plane, | ||||||
|                     ) { |                     ) { | ||||||
|                         // TODO: Validate that the found intersection is within all brush planes
 |                         intersections.push(intersection) | ||||||
|                         vs.push(intersection.get_intersection_point()) |  | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         // 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 |         vs | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue