Skip to content

Commit

Permalink
BooleanDifference secured against single-dimensional regions
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelbaran authored and peterjamesnugent committed Jul 16, 2024
1 parent a03333d commit 86290a2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Geometry_Engine/Compute/BooleanDifference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ public static List<Polyline> BooleanDifference(this Polyline region, List<Polyli

List<Polyline> allRegions = new List<Polyline> { region };
Plane p = region.FitPlane();
if (p == null)
return new List<Polyline>();

foreach (Polyline refRegion in refRegions)
{
if (p.IsCoplanar(refRegion.FitPlane()))
Plane refPlane = refRegion.FitPlane();
if (refPlane != null && p.IsCoplanar(refPlane))
allRegions.Add(refRegion);
}

Expand Down Expand Up @@ -268,9 +272,13 @@ public static List<PolyCurve> BooleanDifference(this ICurve region, IEnumerable<

List<ICurve> allRegions = new List<ICurve> { region };
Plane p = region.IFitPlane();
if (p == null)
return new List<PolyCurve>();

foreach (ICurve refRegion in refRegionsList)
{
if (p.IsCoplanar(refRegion.IFitPlane()))
Plane refPlane = refRegion.IFitPlane();
if (refPlane != null && p.IsCoplanar(refPlane))
allRegions.Add(refRegion);
}

Expand Down

0 comments on commit 86290a2

Please sign in to comment.