public static void PartitionFace_SplitEdges(List <seg3d> segs, Solid s2, BoundingBox3d bb2, bool reverse) { List <seg3d> rm = new List <seg3d>(); List <seg3d> news = new List <seg3d>(); for (int i = 0; i < segs.Count; i++) { seg3d s = segs[i]; if (bb2.SegmentCannotIntersect(s.a, s.b)) { continue; } for (int j = 0; j < s2.Faces.Count; j++) { Face f2 = s2.Faces[j]; xyz hit = f2.CalcSegmentFaceIntersection_HitOnly(s); if (hit != null) { rm.Add(s); seg3d to_the_face = new seg3d(s.a, hit, s.origin); seg3d away_from_the_face = new seg3d(hit, s.b, s.origin); news.Add(to_the_face); news.Add(away_from_the_face); break; } } } if (news.Count > 0) { PartitionFace_SplitEdges(news, s2, bb2, reverse); foreach (seg3d s in rm) { segs.Remove(s); } foreach (seg3d s in news) { segs.Add(s); } } }