@@ -120,6 +120,34 @@ public Fixed64 DistanceSquared(Vector2d point)
120120 return Vector2d . DistanceSquared ( point , ClosestPoint ( point ) ) ;
121121 }
122122
123+ /// <summary>
124+ /// Determines whether the exact minimum distance to another finite segment
125+ /// is at least the supplied threshold.
126+ /// </summary>
127+ /// <remarks>
128+ /// The comparison uses wide rational distances and does not materialize a
129+ /// rounded closest point or square root. Equality is accepted.
130+ /// </remarks>
131+ /// <exception cref="ArgumentOutOfRangeException">
132+ /// Thrown when <paramref name="minimumDistance"/> is negative.
133+ /// </exception>
134+ public readonly bool IsDistanceAtLeast (
135+ FixedSegment2d other ,
136+ Fixed64 minimumDistance )
137+ {
138+ if ( minimumDistance < Fixed64 . Zero )
139+ throw new ArgumentOutOfRangeException ( nameof ( minimumDistance ) ) ;
140+ if ( minimumDistance == Fixed64 . Zero )
141+ return true ;
142+ if ( TryGetUniqueIntersection ( other , out _ , out _ ) )
143+ return false ;
144+
145+ return WidePlanarProjection . AreSegmentEndpointDistancesAtLeast (
146+ this ,
147+ other ,
148+ minimumDistance ) ;
149+ }
150+
123151 /// <summary>
124152 /// Finds the closed parameter interval where this segment intersects a capsule.
125153 /// </summary>
@@ -143,6 +171,41 @@ public readonly bool TryGetCapsuleIntersectionInterval(
143171 out entryParameter ,
144172 out exitParameter ) ;
145173
174+ /// <summary>
175+ /// Finds a conservative parameter enclosure for the closed interval where
176+ /// this segment intersects an endpoint-authored capsule.
177+ /// </summary>
178+ /// <remarks>
179+ /// The exact finite-axis solve rounds its representable interval bounds to
180+ /// nearest. This method expands each returned bound outward by one raw
181+ /// quantum, clamped to [0, 1], so the mathematical interval is enclosed.
182+ /// A zero-length capsule axis is treated as a circle.
183+ /// </remarks>
184+ /// <exception cref="ArgumentOutOfRangeException">
185+ /// Thrown when <paramref name="radius"/> is negative.
186+ /// </exception>
187+ public readonly bool TryGetCapsuleIntersectionParameterEnclosure (
188+ FixedSegment2d capsuleAxis ,
189+ Fixed64 radius ,
190+ out Fixed64 entryParameter ,
191+ out Fixed64 exitParameter )
192+ {
193+ if ( ! TryGetCapsuleIntersectionInterval (
194+ capsuleAxis ,
195+ radius ,
196+ out entryParameter ,
197+ out exitParameter ) )
198+ {
199+ return false ;
200+ }
201+
202+ if ( entryParameter > Fixed64 . Zero )
203+ entryParameter = Fixed64 . FromRaw ( entryParameter . m_rawValue - 1L ) ;
204+ if ( exitParameter < Fixed64 . One )
205+ exitParameter = Fixed64 . FromRaw ( exitParameter . m_rawValue + 1L ) ;
206+ return true ;
207+ }
208+
146209 /// <summary>
147210 /// Finds the closed parameter interval where this segment intersects a radially
148211 /// expanded capsule.
@@ -335,6 +398,37 @@ public readonly bool TryGetUniqueIntersection(
335398 return TryGetUniqueIntersection ( other , out thisParameter , out _ ) ;
336399 }
337400
401+ /// <summary>
402+ /// Attempts to enclose the unique intersection parameter on this segment.
403+ /// </summary>
404+ /// <remarks>
405+ /// The exact rational intersection is enclosed by expanding the nearest
406+ /// representable parameter by one raw unit and clamping to [0, 1]. Collinear
407+ /// positive-length overlaps retain the unique-intersection failure behavior.
408+ /// </remarks>
409+ public readonly bool TryGetUniqueIntersectionParameterEnclosure (
410+ FixedSegment2d other ,
411+ out Fixed64 nearestParameter ,
412+ out Fixed64 lowerParameter ,
413+ out Fixed64 upperParameter )
414+ {
415+ if ( ! TryGetUniqueIntersection ( other , out nearestParameter ) )
416+ {
417+ nearestParameter = default ;
418+ lowerParameter = default ;
419+ upperParameter = default ;
420+ return false ;
421+ }
422+
423+ lowerParameter = nearestParameter > Fixed64 . Zero
424+ ? Fixed64 . FromRaw ( nearestParameter . m_rawValue - 1L )
425+ : Fixed64 . Zero ;
426+ upperParameter = nearestParameter < Fixed64 . One
427+ ? Fixed64 . FromRaw ( nearestParameter . m_rawValue + 1L )
428+ : Fixed64 . One ;
429+ return true ;
430+ }
431+
338432 /// <summary>
339433 /// Returns the closest finite points on this segment and another segment.
340434 /// </summary>
0 commit comments