Skip to content

Commit

Permalink
[GeometriaClipping] Adding tolerance to circular arc simplex coincide…
Browse files Browse the repository at this point in the history
…nce checks
  • Loading branch information
LuizZak committed Aug 18, 2024
1 parent 4eae9a9 commit ca2ec32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/GeometriaClipping/2D/Graph/Simplex2Graph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ public struct Simplex2Graph<Vector: Vector2Real & Hashable> {
case (
.circleArc(let lhsCenter, let lhsRadius, let lhsStart, let lhsSweep),
.circleArc(let rhsCenter, let rhsRadius, let rhsStart, let rhsSweep)
) where lhsCenter == rhsCenter && lhsRadius.isApproximatelyEqualFast(to: rhsRadius, tolerance: tolerance):
) where lhsCenter.isApproximatelyEqualFast(to: rhsCenter, tolerance: tolerance) && lhsRadius.isApproximatelyEqualFast(to: rhsRadius, tolerance: tolerance):
let lhsSweep = AngleSweep(start: lhsStart, sweep: lhsSweep)
let rhsSweep = AngleSweep(start: rhsStart, sweep: rhsSweep)

Expand Down Expand Up @@ -651,7 +651,7 @@ public struct Simplex2Graph<Vector: Vector2Real & Hashable> {
case (
.circleArc(let lhsCenter, let lhsRadius, let lhsStartAngle, let lhsSweepAngle),
.circleArc(let rhsCenter, let rhsRadius, let rhsStartAngle, let rhsSweepAngle)
) where lhsCenter == rhsCenter && lhsRadius.isApproximatelyEqualFast(to: rhsRadius, tolerance: tolerance):
) where lhsCenter.isApproximatelyEqualFast(to: rhsCenter, tolerance: tolerance) && lhsRadius.isApproximatelyEqualFast(to: rhsRadius, tolerance: tolerance):
let lhsSweep = AngleSweep(start: lhsStartAngle, sweep: lhsSweepAngle)
let rhsSweep = AngleSweep(start: rhsStartAngle, sweep: rhsSweepAngle)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Geometria

extension Vector2FloatingPoint {
@inlinable
func isApproximatelyEqualFast(to other: Self, tolerance: Scalar) -> Bool {
return x.isApproximatelyEqualFast(to: other.x, tolerance: tolerance)
&& y.isApproximatelyEqualFast(to: other.y, tolerance: tolerance)
}
}

0 comments on commit ca2ec32

Please sign in to comment.