< Summary

Line coverage
100%
Covered lines: 828
Uncovered lines: 0
Coverable lines: 828
Total lines: 2131
Line coverage: 100%
Branch coverage
100%
Covered branches: 162
Total branches: 162
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
File 1: TryGetDistanceToCenteredAxis(...)100%11100%
File 1: TryGetDistanceBetweenCenteredAxes(...)100%11100%
File 1: DoCenteredCapsulesOverlap(...)100%44100%
File 1: TryGetCenteredCapsulesContact(...)100%66100%
File 1: TryGetCenteredAxisEndpoint(...)100%11100%
File 1: TryGetCenteredCapsuleSupport(...)100%22100%
File 1: GetCenteredCapsuleSupportAnchor(...)100%22100%
File 1: GetDistanceToCenteredCapsule(...)100%11100%
File 1: TryGetDistanceToCenteredCapsule(...)100%22100%
File 1: ContainsPointInCenteredCapsule(...)100%11100%
File 1: ContainsPointInCenteredCapsule(...)100%11100%
File 1: ContainsPointInCenteredCapsule(...)100%11100%
File 1: ContainsPointInCenteredCapsule(...)100%44100%
File 1: TryGetSurfacePointOnCenteredCapsule(...)100%44100%
File 1: TryGetSurfaceOffsetOnCenteredCapsule(...)100%44100%
File 1: GetSurfaceAnchorOnCenteredCapsule(...)100%44100%
File 1: GetDirectionFromCenteredAxis(...)100%11100%
File 1: TryGetClosestPointsBetweenCenteredAxes(...)100%11100%
File 1: ValidateCenteredAxis(...)100%11100%
File 1: ValidateCenteredAxis(...)100%44100%
File 1: ContainsPointInCenteredCapsule(...)100%11100%
File 1: ContainsPointInCenteredCapsule(...)100%11100%
File 1: ContainsPointInCenteredCapsule(...)100%22100%
File 1: GetDirectionFromCenteredAxis(...)100%11100%
File 1: GetDistanceToCenteredCapsule(...)100%11100%
File 1: TryGetDistanceToCenteredCapsule(...)100%11100%
File 1: TryGetCenteredCapsuleSupport(...)100%11100%
File 1: TryGetSurfacePointOnCenteredCapsule(...)100%22100%
File 1: TryGetSurfaceOffsetOnCenteredCapsule(...)100%22100%
File 1: DoCenteredCapsulesOverlap(...)100%11100%
File 1: TryGetCenteredCapsulesContact(...)100%22100%
File 1: TryGetCenteredCapsuleConvexMinimumTranslation(...)100%22100%
File 1: TryGetSweptCenteredCapsuleSegmentFirstDistance(...)100%11100%
File 1: TryGetSweptCenteredCapsulesFirstDistance(...)100%11100%
File 1: TryGetCapsuleIntersectionDistanceInterval(...)100%22100%
File 1: GetRotatedPositiveYAxis(...)100%11100%
File 1: ValidateRotatedCapsule(...)100%22100%
File 2: TryGetCenteredCapsuleConvexMinimumTranslation(...)100%44100%
File 2: TryGetCenteredCapsuleConvexMinimumTranslation(...)100%44100%
File 2: TryGetCenteredCapsuleConvexContacts(...)100%88100%
File 2: TryGetSweptCenteredCapsuleSegmentFirstDistance(...)100%11100%
File 2: TryGetSweptCenteredCapsulesFirstDistance(...)100%11100%
File 2: ValidateSweep(...)100%88100%
File 3: .ctor(...)100%11100%
File 3: get_Delta()100%11100%
File 3: get_Length()100%11100%
File 3: get_LengthSquared()100%11100%
File 3: get_Bounds()100%11100%
File 3: ClosestPoint(...)100%11100%
File 3: DistanceSquared(...)100%11100%
File 3: TryGetCapsuleIntersectionInterval(...)100%11100%
File 3: TryGetCapsuleIntersectionInterval(...)100%11100%
File 3: TryGetCapsuleIntersectionInterval(...)100%44100%
File 3: TryGetCapsuleIntersectionInterval(...)100%11100%
File 3: TryGetCapsuleIntersectionInterval(...)100%11100%
File 3: TryGetCapsuleIntersectionInterval(...)100%88100%
File 3: TryGetUniqueIntersection(...)100%11100%
File 3: GetClosestPoints(...)100%1010100%
File 3: TryGetUniqueIntersection(...)100%2020100%
File 3: Interpolate(...)100%11100%
File 3: PointOnSegment(...)100%88100%
File 3: ConsiderSharedEndpoint(...)100%88100%
File 3: ConsiderClosestCandidate(...)100%22100%
File 3: Deconstruct(...)100%11100%
File 3: op_Equality(...)100%11100%
File 3: op_Inequality(...)100%11100%
File 3: Equals(...)100%22100%
File 3: Equals(...)100%22100%
File 3: GetHashCode()100%11100%
File 3: TryGetCircleIntersectionDistanceInterval(...)100%11100%
File 3: TryGetCircleIntersectionDistanceInterval(...)100%22100%
File 3: TryGetCapsuleIntersectionDistanceInterval(...)100%11100%
File 3: TryGetCapsuleIntersectionDistanceInterval(...)100%44100%
File 3: TryGetCapsuleIntersectionDistanceInterval(...)100%11100%
File 3: TryGetCapsuleIntersectionDistanceInterval(...)100%44100%
File 3: GetPointAtDistance(...)100%44100%
File 3: ValidateDistance(...)100%44100%
File 3: ValidateTotalDistance(...)100%66100%

File(s)

/home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Primitives/Segments/FixedSegment2d.CenteredAxis.cs

#LineLine coverage
 1//=======================================================================
 2// FixedSegment2d.CenteredAxis.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024–present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9
 10namespace FixedMathSharp.Geometry;
 11
 12/// <content>
 13/// Contains centered-axis and rotated-capsule geometry that avoids
 14/// materializing potentially unrepresentable segment endpoints.
 15/// </content>
 16public partial struct FixedSegment2d
 17{
 18    /// <summary>
 19    /// Attempts to return the rounded distance from a point to a conceptual
 20    /// centered finite axis without materializing its endpoints.
 21    /// </summary>
 22    /// <returns>
 23    /// True when the final distance is representable; otherwise false and
 24    /// <paramref name="distance"/> is <see cref="Fixed64.MaxValue"/>.
 25    /// </returns>
 26    public static bool TryGetDistanceToCenteredAxis(
 27        Vector2d point,
 28        Vector2d center,
 29        Vector2d axisDirection,
 30        Fixed64 axisLength,
 31        out Fixed64 distance)
 32    {
 233        ValidateCenteredAxis(axisDirection, axisLength);
 234        return WideFiniteAxisIntersection.TryGetDistanceToCenteredAxis(
 235            point,
 236            center,
 237            axisDirection,
 238            axisLength,
 239            out distance);
 40    }
 41
 42    /// <summary>
 43    /// Attempts to return the rounded distance between two conceptual
 44    /// centered finite axes without materializing either pair of endpoints.
 45    /// </summary>
 46    /// <returns>
 47    /// True when the final distance is representable; otherwise false and
 48    /// <paramref name="distance"/> is <see cref="Fixed64.MaxValue"/>.
 49    /// </returns>
 50    public static bool TryGetDistanceBetweenCenteredAxes(
 51        Vector2d firstCenter,
 52        Vector2d firstAxisDirection,
 53        Fixed64 firstAxisLength,
 54        Vector2d secondCenter,
 55        Vector2d secondAxisDirection,
 56        Fixed64 secondAxisLength,
 57        out Fixed64 distance)
 58    {
 461259        ValidateCenteredAxis(
 461260            firstAxisDirection,
 461261            firstAxisLength,
 461262            nameof(firstAxisDirection),
 461263            nameof(firstAxisLength));
 461164        ValidateCenteredAxis(
 461165            secondAxisDirection,
 461166            secondAxisLength,
 461167            nameof(secondAxisDirection),
 461168            nameof(secondAxisLength));
 461069        return WideFiniteAxisIntersection.TryGetDistanceBetweenCenteredAxes(
 461070            firstCenter,
 461071            firstAxisDirection,
 461072            firstAxisLength,
 461073            secondCenter,
 461074            secondAxisDirection,
 461075            secondAxisLength,
 461076            out distance);
 77    }
 78
 79    /// <summary>
 80    /// Returns whether two conceptual centered capsules overlap, including
 81    /// exact tangency, without narrowing their axis distance or radius sum.
 82    /// </summary>
 83    public static bool DoCenteredCapsulesOverlap(
 84        Vector2d firstCenter,
 85        Vector2d firstAxisDirection,
 86        Fixed64 firstAxisLength,
 87        Fixed64 firstRadius,
 88        Vector2d secondCenter,
 89        Vector2d secondAxisDirection,
 90        Fixed64 secondAxisLength,
 91        Fixed64 secondRadius)
 92    {
 461393        ValidateCenteredAxis(
 461394            firstAxisDirection,
 461395            firstAxisLength,
 461396            nameof(firstAxisDirection),
 461397            nameof(firstAxisLength));
 461398        if (firstRadius < Fixed64.Zero)
 199            throw new ArgumentOutOfRangeException(nameof(firstRadius));
 4612100        ValidateCenteredAxis(
 4612101            secondAxisDirection,
 4612102            secondAxisLength,
 4612103            nameof(secondAxisDirection),
 4612104            nameof(secondAxisLength));
 4612105        if (secondRadius < Fixed64.Zero)
 1106            throw new ArgumentOutOfRangeException(nameof(secondRadius));
 107
 4611108        return WideFiniteAxisIntersection.DoCenteredCapsulesOverlap(
 4611109            firstCenter,
 4611110            firstAxisDirection,
 4611111            firstAxisLength,
 4611112            firstRadius,
 4611113            secondCenter,
 4611114            secondAxisDirection,
 4611115            secondAxisLength,
 4611116            secondRadius);
 117    }
 118
 119    /// <summary>
 120    /// Attempts to build an exact contact between two conceptual centered
 121    /// capsules.
 122    /// </summary>
 123    /// <remarks>
 124    /// Each surface witness retains its axial and radial contributions
 125    /// separately. Classification is independent of absolute world-point
 126    /// materialization.
 127    /// </remarks>
 128    public static bool TryGetCenteredCapsulesContact(
 129        Vector2d firstCenter,
 130        Fixed64 firstAnchorRotation,
 131        Vector2d firstAxisDirection,
 132        Fixed64 firstAxisLength,
 133        Fixed64 firstRadius,
 134        Vector2d secondCenter,
 135        Fixed64 secondAnchorRotation,
 136        Vector2d secondAxisDirection,
 137        Fixed64 secondAxisLength,
 138        Fixed64 secondRadius,
 139        Vector2d fallbackNormal,
 140        out FixedContactAnchors2d contact)
 141    {
 10142        ValidateCenteredAxis(
 10143            firstAxisDirection,
 10144            firstAxisLength,
 10145            nameof(firstAxisDirection),
 10146            nameof(firstAxisLength));
 10147        if (firstRadius < Fixed64.Zero)
 1148            throw new ArgumentOutOfRangeException(nameof(firstRadius));
 9149        ValidateCenteredAxis(
 9150            secondAxisDirection,
 9151            secondAxisLength,
 9152            nameof(secondAxisDirection),
 9153            nameof(secondAxisLength));
 9154        if (secondRadius < Fixed64.Zero)
 1155            throw new ArgumentOutOfRangeException(nameof(secondRadius));
 8156        if (!fallbackNormal.IsNormalized())
 1157            throw new ArgumentException("Fallback normal must be normalized.", nameof(fallbackNormal));
 158
 7159        return WideFiniteAxisIntersection.TryGetCenteredCapsulesContact(
 7160            firstCenter,
 7161            firstAnchorRotation,
 7162            firstAxisDirection,
 7163            firstAxisLength,
 7164            firstRadius,
 7165            secondCenter,
 7166            secondAnchorRotation,
 7167            secondAxisDirection,
 7168            secondAxisLength,
 7169            secondRadius,
 7170            fallbackNormal,
 7171            out contact);
 172    }
 173
 174    /// <summary>
 175    /// Attempts to materialize one endpoint of a conceptual centered finite
 176    /// axis from its normalized direction and full length.
 177    /// </summary>
 178    /// <remarks>
 179    /// The endpoint is rounded only after combining its center and half-length
 180    /// contribution. Failure is atomic.
 181    /// </remarks>
 182    public static bool TryGetCenteredAxisEndpoint(
 183        Vector2d center,
 184        Vector2d axisDirection,
 185        Fixed64 axisLength,
 186        bool positive,
 187        out Vector2d endpoint)
 188    {
 3189        ValidateCenteredAxis(axisDirection, axisLength);
 2190        return WideFiniteAxisIntersection.TryGetCenteredAxisEndpoint(
 2191            center,
 2192            axisDirection,
 2193            axisLength,
 2194            positive,
 2195            out endpoint);
 196    }
 197
 198    /// <summary>
 199    /// Attempts to materialize the support point of a conceptual centered
 200    /// capsule in a world-space direction.
 201    /// </summary>
 202    /// <remarks>
 203    /// The direction need not be normalized. A zero direction and an exact
 204    /// axial tie select the capsule center along the tied axis.
 205    /// </remarks>
 206    public static bool TryGetCenteredCapsuleSupport(
 207        Vector2d center,
 208        Vector2d axisDirection,
 209        Fixed64 axisLength,
 210        Fixed64 radius,
 211        Vector2d direction,
 212        out Vector2d support)
 213    {
 4214        ValidateCenteredAxis(axisDirection, axisLength);
 4215        if (radius < Fixed64.Zero)
 1216            throw new ArgumentOutOfRangeException(nameof(radius));
 217
 3218        return WideFiniteAxisIntersection.TryGetCenteredCapsuleSupport(
 3219            center,
 3220            axisDirection,
 3221            axisLength,
 3222            radius,
 3223            direction,
 3224            out support);
 225    }
 226
 227    /// <summary>
 228    /// Returns the support anchor of a conceptual centered capsule without
 229    /// combining its axial and radial feature components.
 230    /// </summary>
 231    /// <remarks>
 232    /// The direction need not be normalized. A zero direction and an exact
 233    /// axial tie select the axis center.
 234    /// </remarks>
 235    public static FixedPointAnchor2d GetCenteredCapsuleSupportAnchor(
 236        Vector2d center,
 237        Fixed64 frameRotation,
 238        Vector2d localAxisDirection,
 239        Fixed64 axisLength,
 240        Fixed64 radius,
 241        Vector2d localDirection)
 242    {
 156243        ValidateCenteredAxis(localAxisDirection, axisLength);
 155244        if (radius < Fixed64.Zero)
 1245            throw new ArgumentOutOfRangeException(nameof(radius));
 246
 154247        return WideFiniteAxisIntersection.GetCenteredCapsuleSupportAnchor(
 154248            center,
 154249            frameRotation,
 154250            localAxisDirection,
 154251            axisLength,
 154252            radius,
 154253            localDirection);
 254    }
 255
 256    /// <summary>
 257    /// Returns the rounded nonnegative distance from a point to a conceptual
 258    /// centered capsule surface, saturating to <see cref="Fixed64.MaxValue"/>
 259    /// when the distance is not representable.
 260    /// </summary>
 261    /// <remarks>
 262    /// The final value uses round-half-to-even. Points inside or on the capsule
 263    /// return zero.
 264    /// </remarks>
 265    /// <exception cref="ArgumentException">
 266    /// Thrown when <paramref name="axisDirection"/> is zero or not normalized.
 267    /// </exception>
 268    /// <exception cref="ArgumentOutOfRangeException">
 269    /// Thrown when <paramref name="axisLength"/> or <paramref name="radius"/>
 270    /// is negative.
 271    /// </exception>
 272    public static Fixed64 GetDistanceToCenteredCapsule(
 273        Vector2d point,
 274        Vector2d center,
 275        Vector2d axisDirection,
 276        Fixed64 axisLength,
 277        Fixed64 radius)
 278    {
 2279        TryGetDistanceToCenteredCapsule(
 2280            point,
 2281            center,
 2282            axisDirection,
 2283            axisLength,
 2284            radius,
 2285            out Fixed64 distance);
 2286        return distance;
 287    }
 288
 289    /// <summary>
 290    /// Attempts to return the rounded nonnegative distance from a point to a
 291    /// conceptual centered capsule surface.
 292    /// </summary>
 293    /// <remarks>The final value uses round-half-to-even.</remarks>
 294    /// <returns>
 295    /// True when the final distance is representable; otherwise false and
 296    /// <paramref name="distance"/> is <see cref="Fixed64.MaxValue"/>.
 297    /// Points inside or on the capsule return zero.
 298    /// </returns>
 299    /// <exception cref="ArgumentException">
 300    /// Thrown when <paramref name="axisDirection"/> is zero or not normalized.
 301    /// </exception>
 302    /// <exception cref="ArgumentOutOfRangeException">
 303    /// Thrown when <paramref name="axisLength"/> or <paramref name="radius"/>
 304    /// is negative.
 305    /// </exception>
 306    public static bool TryGetDistanceToCenteredCapsule(
 307        Vector2d point,
 308        Vector2d center,
 309        Vector2d axisDirection,
 310        Fixed64 axisLength,
 311        Fixed64 radius,
 312        out Fixed64 distance)
 313    {
 8314        ValidateCenteredAxis(axisDirection, axisLength);
 8315        if (radius < Fixed64.Zero)
 1316            throw new ArgumentOutOfRangeException(nameof(radius));
 317
 7318        return WideFiniteAxisIntersection.TryGetDistanceToCenteredCapsule(
 7319            point,
 7320            center,
 7321            axisDirection,
 7322            axisLength,
 7323            radius,
 7324            out distance);
 325    }
 326
 327    /// <summary>
 328    /// Returns whether a point lies inside or on a conceptual centered capsule.
 329    /// </summary>
 330    /// <exception cref="ArgumentException">
 331    /// Thrown when <paramref name="axisDirection"/> is zero or not normalized.
 332    /// </exception>
 333    /// <exception cref="ArgumentOutOfRangeException">
 334    /// Thrown when <paramref name="axisLength"/> or <paramref name="radius"/>
 335    /// is negative.
 336    /// </exception>
 337    public static bool ContainsPointInCenteredCapsule(
 338        Vector2d point,
 339        Vector2d center,
 340        Vector2d axisDirection,
 341        Fixed64 axisLength,
 342        Fixed64 radius) =>
 7343        ContainsPointInCenteredCapsule(
 7344            point,
 7345            center,
 7346            axisDirection,
 7347            axisLength,
 7348            radius,
 7349            Fixed64.Zero,
 7350            strict: false);
 351
 352    /// <summary>
 353    /// Returns whether a point lies strictly inside or inclusively within a
 354    /// conceptual centered capsule.
 355    /// </summary>
 356    public static bool ContainsPointInCenteredCapsule(
 357        Vector2d point,
 358        Vector2d center,
 359        Vector2d axisDirection,
 360        Fixed64 axisLength,
 361        Fixed64 radius,
 362        bool strict) =>
 3363        ContainsPointInCenteredCapsule(
 3364            point,
 3365            center,
 3366            axisDirection,
 3367            axisLength,
 3368            radius,
 3369            Fixed64.Zero,
 3370            strict);
 371
 372    /// <summary>
 373    /// Returns whether a point lies inside or on a conceptual centered capsule,
 374    /// including a nonnegative radial expansion.
 375    /// </summary>
 376    /// <exception cref="ArgumentException">
 377    /// Thrown when <paramref name="axisDirection"/> is zero or not normalized.
 378    /// </exception>
 379    /// <exception cref="ArgumentOutOfRangeException">
 380    /// Thrown when <paramref name="axisLength"/>, <paramref name="radius"/>,
 381    /// or <paramref name="radiusExpansion"/> is negative.
 382    /// </exception>
 383    public static bool ContainsPointInCenteredCapsule(
 384        Vector2d point,
 385        Vector2d center,
 386        Vector2d axisDirection,
 387        Fixed64 axisLength,
 388        Fixed64 radius,
 389        Fixed64 radiusExpansion) =>
 5390        ContainsPointInCenteredCapsule(
 5391            point,
 5392            center,
 5393            axisDirection,
 5394            axisLength,
 5395            radius,
 5396            radiusExpansion,
 5397            strict: false);
 398
 399    /// <summary>
 400    /// Returns whether a point lies strictly inside or inclusively within a
 401    /// conceptual centered capsule with nonnegative radial expansion.
 402    /// </summary>
 403    public static bool ContainsPointInCenteredCapsule(
 404        Vector2d point,
 405        Vector2d center,
 406        Vector2d axisDirection,
 407        Fixed64 axisLength,
 408        Fixed64 radius,
 409        Fixed64 radiusExpansion,
 410        bool strict)
 411    {
 17412        ValidateCenteredAxis(axisDirection, axisLength);
 17413        if (radius < Fixed64.Zero)
 1414            throw new ArgumentOutOfRangeException(nameof(radius));
 16415        if (radiusExpansion < Fixed64.Zero)
 1416            throw new ArgumentOutOfRangeException(nameof(radiusExpansion));
 417
 15418        return WideFiniteAxisIntersection.ContainsPointInCenteredCapsule(
 15419            point,
 15420            center,
 15421            axisDirection,
 15422            axisLength,
 15423            radius,
 15424            radiusExpansion,
 15425            strict);
 426    }
 427
 428    /// <summary>
 429    /// Attempts to return the selected point on a conceptual centered capsule
 430    /// surface without narrowing its axis point before applying the radial offset.
 431    /// </summary>
 432    /// <remarks>
 433    /// <paramref name="surfaceDirection"/> must be the nonzero result of
 434    /// <see cref="GetDirectionFromCenteredAxis(Vector2d, Vector2d, Vector2d, Fixed64)"/>,
 435    /// or a caller-selected normalized
 436    /// direction perpendicular to the axis when that method returns zero.
 437    /// </remarks>
 438    /// <returns>
 439    /// True when every final surface coordinate is representable; otherwise
 440    /// false and <paramref name="surfacePoint"/> is zero.
 441    /// </returns>
 442    /// <exception cref="ArgumentException">
 443    /// Thrown when <paramref name="axisDirection"/> is zero or not normalized,
 444    /// or when <paramref name="surfaceDirection"/> is not normalized.
 445    /// </exception>
 446    /// <exception cref="ArgumentOutOfRangeException">
 447    /// Thrown when <paramref name="axisLength"/> or <paramref name="radius"/>
 448    /// is negative.
 449    /// </exception>
 450    public static bool TryGetSurfacePointOnCenteredCapsule(
 451        Vector2d point,
 452        Vector2d center,
 453        Vector2d axisDirection,
 454        Fixed64 axisLength,
 455        Fixed64 radius,
 456        Vector2d surfaceDirection,
 457        out Vector2d surfacePoint)
 458    {
 9459        ValidateCenteredAxis(axisDirection, axisLength);
 9460        if (radius < Fixed64.Zero)
 1461            throw new ArgumentOutOfRangeException(nameof(radius));
 8462        if (!surfaceDirection.IsNormalized())
 1463            throw new ArgumentException("Surface direction must be normalized.", nameof(surfaceDirection));
 464
 7465        return WideFiniteAxisIntersection.TryGetSurfacePointOnCenteredCapsule(
 7466            point,
 7467            center,
 7468            axisDirection,
 7469            axisLength,
 7470            radius,
 7471            surfaceDirection,
 7472            out surfacePoint);
 473    }
 474
 475    /// <summary>
 476    /// Attempts to return the center-relative surface offset on a conceptual
 477    /// centered capsule nearest to a world-space point in the supplied surface
 478    /// direction.
 479    /// </summary>
 480    public static bool TryGetSurfaceOffsetOnCenteredCapsule(
 481        Vector2d point,
 482        Vector2d center,
 483        Vector2d axisDirection,
 484        Fixed64 axisLength,
 485        Fixed64 radius,
 486        Vector2d surfaceDirection,
 487        out Vector2d surfaceOffset)
 488    {
 5489        ValidateCenteredAxis(axisDirection, axisLength);
 5490        if (radius < Fixed64.Zero)
 1491            throw new ArgumentOutOfRangeException(nameof(radius));
 4492        if (!surfaceDirection.IsNormalized())
 493        {
 1494            throw new ArgumentException(
 1495                "Surface direction must be normalized.",
 1496                nameof(surfaceDirection));
 497        }
 498
 3499        return WideFiniteAxisIntersection.TryGetSurfaceOffsetOnCenteredCapsule(
 3500            point,
 3501            center,
 3502            axisDirection,
 3503            axisLength,
 3504            radius,
 3505            surfaceDirection,
 3506            out surfaceOffset);
 507    }
 508
 509    /// <summary>
 510    /// Returns the centered-capsule surface anchor nearest to a world-space
 511    /// point in the supplied normalized surface direction.
 512    /// </summary>
 513    public static FixedPointAnchor2d GetSurfaceAnchorOnCenteredCapsule(
 514        Vector2d point,
 515        Vector2d center,
 516        Fixed64 frameRotation,
 517        Vector2d localAxisDirection,
 518        Fixed64 axisLength,
 519        Fixed64 radius,
 520        Vector2d localSurfaceDirection)
 521    {
 5522        ValidateCenteredAxis(localAxisDirection, axisLength);
 5523        if (radius < Fixed64.Zero)
 1524            throw new ArgumentOutOfRangeException(nameof(radius));
 4525        if (!localSurfaceDirection.IsNormalized())
 526        {
 1527            throw new ArgumentException(
 1528                "Surface direction must be normalized.",
 1529                nameof(localSurfaceDirection));
 530        }
 531
 3532        return WideFiniteAxisIntersection.GetSurfaceAnchorOnCenteredCapsule(
 3533            point,
 3534            center,
 3535            frameRotation,
 3536            localAxisDirection,
 3537            axisLength,
 3538            radius,
 3539            localSurfaceDirection);
 540    }
 541
 542    /// <summary>
 543    /// Returns the normalized direction from the closest point on a conceptual
 544    /// centered finite axis toward <paramref name="point"/>, or zero when the
 545    /// point lies on that axis.
 546    /// </summary>
 547    /// <remarks>
 548    /// The conceptual endpoints are
 549    /// <c>center +/- axisDirection * (axisLength / 2)</c>. They are never
 550    /// constructed or narrowed before the closest-feature decision.
 551    /// </remarks>
 552    /// <exception cref="ArgumentException">
 553    /// Thrown when <paramref name="axisDirection"/> is zero or not normalized.
 554    /// </exception>
 555    /// <exception cref="ArgumentOutOfRangeException">
 556    /// Thrown when <paramref name="axisLength"/> is negative.
 557    /// </exception>
 558    public static Vector2d GetDirectionFromCenteredAxis(
 559        Vector2d point,
 560        Vector2d center,
 561        Vector2d axisDirection,
 562        Fixed64 axisLength)
 563    {
 7564        ValidateCenteredAxis(axisDirection, axisLength);
 565
 5566        return WideFiniteAxisIntersection.GetDirectionFromCenteredAxis(
 5567            point,
 5568            center,
 5569            axisDirection,
 5570            axisLength);
 571    }
 572
 573    /// <summary>
 574    /// Attempts to return the closest points on two conceptual centered finite
 575    /// axes described by normalized directions and full lengths.
 576    /// </summary>
 577    /// <returns>
 578    /// <see langword="true"/> when both final world points are representable;
 579    /// otherwise <see langword="false"/> and both outputs are zero.
 580    /// </returns>
 581    public static bool TryGetClosestPointsBetweenCenteredAxes(
 582        Vector2d firstCenter,
 583        Vector2d firstAxisDirection,
 584        Fixed64 firstAxisLength,
 585        Vector2d secondCenter,
 586        Vector2d secondAxisDirection,
 587        Fixed64 secondAxisLength,
 588        out Vector2d firstPoint,
 589        out Vector2d secondPoint)
 590    {
 4591        ValidateCenteredAxis(
 4592            firstAxisDirection,
 4593            firstAxisLength,
 4594            nameof(firstAxisDirection),
 4595            nameof(firstAxisLength));
 4596        ValidateCenteredAxis(
 4597            secondAxisDirection,
 4598            secondAxisLength,
 4599            nameof(secondAxisDirection),
 4600            nameof(secondAxisLength));
 4601        return WideFiniteAxisIntersection.TryGetClosestPointsBetweenCenteredAxes(
 4602            firstCenter,
 4603            firstAxisDirection,
 4604            firstAxisLength,
 4605            secondCenter,
 4606            secondAxisDirection,
 4607            secondAxisLength,
 4608            out firstPoint,
 4609            out secondPoint);
 610    }
 611
 612    private static void ValidateCenteredAxis(Vector2d axisDirection, Fixed64 axisLength)
 305613        => ValidateCenteredAxis(
 305614            axisDirection,
 305615            axisLength,
 305616            nameof(axisDirection),
 305617            nameof(axisLength));
 618
 619    private static void ValidateCenteredAxis(
 620        Vector2d axisDirection,
 621        Fixed64 axisLength,
 622        string directionParameterName,
 623        string lengthParameterName)
 624    {
 18790625        if (!axisDirection.IsNormalized())
 6626            throw new ArgumentException("Axis direction must be normalized.", directionParameterName);
 18784627        if (axisLength < Fixed64.Zero)
 3628            throw new ArgumentOutOfRangeException(lengthParameterName);
 18781629    }
 630
 631    /// <summary>
 632    /// Returns whether a point lies inside or on a centered rotated capsule.
 633    /// </summary>
 634    public static bool ContainsPointInCenteredCapsule(
 635        Vector2d point,
 636        Vector2d center,
 637        Fixed64 frameRotation,
 638        Fixed64 axisLength,
 639        Fixed64 radius) =>
 1640        ContainsPointInCenteredCapsule(
 1641            point,
 1642            center,
 1643            frameRotation,
 1644            axisLength,
 1645            radius,
 1646            Fixed64.Zero,
 1647            strict: false);
 648
 649    /// <summary>
 650    /// Returns whether a point lies inside or on a radially expanded centered
 651    /// rotated capsule.
 652    /// </summary>
 653    public static bool ContainsPointInCenteredCapsule(
 654        Vector2d point,
 655        Vector2d center,
 656        Fixed64 frameRotation,
 657        Fixed64 axisLength,
 658        Fixed64 radius,
 659        Fixed64 radiusExpansion) =>
 1660        ContainsPointInCenteredCapsule(
 1661            point,
 1662            center,
 1663            frameRotation,
 1664            axisLength,
 1665            radius,
 1666            radiusExpansion,
 1667            strict: false);
 668
 669    /// <summary>
 670    /// Returns whether a point lies within a centered capsule whose local
 671    /// positive Y axis is transformed by a scalar rigid-frame rotation.
 672    /// </summary>
 673    public static bool ContainsPointInCenteredCapsule(
 674        Vector2d point,
 675        Vector2d center,
 676        Fixed64 frameRotation,
 677        Fixed64 axisLength,
 678        Fixed64 radius,
 679        Fixed64 radiusExpansion,
 680        bool strict)
 681    {
 4682        ValidateRotatedCapsule(axisLength, radius);
 4683        if (radiusExpansion < Fixed64.Zero)
 1684            throw new ArgumentOutOfRangeException(nameof(radiusExpansion));
 685
 3686        return WideFiniteAxisIntersection.ContainsPointInCenteredCapsule(
 3687            point,
 3688            center,
 3689            GetRotatedPositiveYAxis(frameRotation),
 3690            axisLength,
 3691            radius,
 3692            radiusExpansion,
 3693            strict);
 694    }
 695
 696    /// <summary>
 697    /// Returns the normalized direction from the closest point on a centered
 698    /// capsule axis expressed by a scalar rigid-frame rotation.
 699    /// </summary>
 700    public static Vector2d GetDirectionFromCenteredAxis(
 701        Vector2d point,
 702        Vector2d center,
 703        Fixed64 frameRotation,
 704        Fixed64 axisLength)
 705    {
 1706        ValidateCenteredAxis(Vector2d.Forward, axisLength);
 1707        return WideFiniteAxisIntersection.GetDirectionFromCenteredAxis(
 1708            point,
 1709            center,
 1710            GetRotatedPositiveYAxis(frameRotation),
 1711            axisLength);
 712    }
 713
 714    /// <summary>
 715    /// Returns the rounded distance from a point to a centered rotated capsule.
 716    /// </summary>
 717    public static Fixed64 GetDistanceToCenteredCapsule(
 718        Vector2d point,
 719        Vector2d center,
 720        Fixed64 frameRotation,
 721        Fixed64 axisLength,
 722        Fixed64 radius)
 723    {
 1724        _ = TryGetDistanceToCenteredCapsule(
 1725            point,
 1726            center,
 1727            frameRotation,
 1728            axisLength,
 1729            radius,
 1730            out Fixed64 distance);
 1731        return distance;
 732    }
 733
 734    /// <summary>
 735    /// Attempts to return the rounded distance from a point to a centered
 736    /// rotated capsule.
 737    /// </summary>
 738    public static bool TryGetDistanceToCenteredCapsule(
 739        Vector2d point,
 740        Vector2d center,
 741        Fixed64 frameRotation,
 742        Fixed64 axisLength,
 743        Fixed64 radius,
 744        out Fixed64 distance)
 745    {
 2746        ValidateRotatedCapsule(axisLength, radius);
 2747        return WideFiniteAxisIntersection.TryGetDistanceToCenteredCapsule(
 2748            point,
 2749            center,
 2750            GetRotatedPositiveYAxis(frameRotation),
 2751            axisLength,
 2752            radius,
 2753            out distance);
 754    }
 755
 756    /// <summary>
 757    /// Attempts to materialize support for a centered rotated capsule.
 758    /// </summary>
 759    public static bool TryGetCenteredCapsuleSupport(
 760        Vector2d center,
 761        Fixed64 frameRotation,
 762        Fixed64 axisLength,
 763        Fixed64 radius,
 764        Vector2d direction,
 765        out Vector2d support)
 766    {
 2767        ValidateRotatedCapsule(axisLength, radius);
 1768        return WideFiniteAxisIntersection.TryGetCenteredCapsuleSupport(
 1769            center,
 1770            GetRotatedPositiveYAxis(frameRotation),
 1771            axisLength,
 1772            radius,
 1773            direction,
 1774            out support);
 775    }
 776
 777    /// <summary>
 778    /// Attempts to materialize the selected surface point of a centered
 779    /// rotated capsule.
 780    /// </summary>
 781    public static bool TryGetSurfacePointOnCenteredCapsule(
 782        Vector2d point,
 783        Vector2d center,
 784        Fixed64 frameRotation,
 785        Fixed64 axisLength,
 786        Fixed64 radius,
 787        Vector2d surfaceDirection,
 788        out Vector2d surfacePoint)
 789    {
 2790        ValidateRotatedCapsule(axisLength, radius);
 2791        if (!surfaceDirection.IsNormalized())
 792        {
 1793            throw new ArgumentException(
 1794                "Surface direction must be normalized.",
 1795                nameof(surfaceDirection));
 796        }
 797
 1798        return WideFiniteAxisIntersection.TryGetSurfacePointOnCenteredCapsule(
 1799            point,
 1800            center,
 1801            GetRotatedPositiveYAxis(frameRotation),
 1802            axisLength,
 1803            radius,
 1804            surfaceDirection,
 1805            out surfacePoint);
 806    }
 807
 808    /// <summary>
 809    /// Attempts to materialize the center-relative selected surface offset of
 810    /// a centered rotated capsule.
 811    /// </summary>
 812    public static bool TryGetSurfaceOffsetOnCenteredCapsule(
 813        Vector2d point,
 814        Vector2d center,
 815        Fixed64 frameRotation,
 816        Fixed64 axisLength,
 817        Fixed64 radius,
 818        Vector2d surfaceDirection,
 819        out Vector2d surfaceOffset)
 820    {
 2821        ValidateRotatedCapsule(axisLength, radius);
 2822        if (!surfaceDirection.IsNormalized())
 823        {
 1824            throw new ArgumentException(
 1825                "Surface direction must be normalized.",
 1826                nameof(surfaceDirection));
 827        }
 828
 1829        return WideFiniteAxisIntersection.TryGetSurfaceOffsetOnCenteredCapsule(
 1830            point,
 1831            center,
 1832            GetRotatedPositiveYAxis(frameRotation),
 1833            axisLength,
 1834            radius,
 1835            surfaceDirection,
 1836            out surfaceOffset);
 837    }
 838
 839    /// <summary>
 840    /// Returns whether two centered capsules expressed by scalar rigid-frame
 841    /// rotations overlap, including exact tangency.
 842    /// </summary>
 843    public static bool DoCenteredCapsulesOverlap(
 844        Vector2d firstCenter,
 845        Fixed64 firstRotation,
 846        Fixed64 firstAxisLength,
 847        Fixed64 firstRadius,
 848        Vector2d secondCenter,
 849        Fixed64 secondRotation,
 850        Fixed64 secondAxisLength,
 851        Fixed64 secondRadius)
 852    {
 1853        ValidateRotatedCapsule(firstAxisLength, firstRadius);
 1854        ValidateRotatedCapsule(secondAxisLength, secondRadius);
 1855        return WideFiniteAxisIntersection.DoCenteredCapsulesOverlap(
 1856            firstCenter,
 1857            GetRotatedPositiveYAxis(firstRotation),
 1858            firstAxisLength,
 1859            firstRadius,
 1860            secondCenter,
 1861            GetRotatedPositiveYAxis(secondRotation),
 1862            secondAxisLength,
 1863            secondRadius);
 864    }
 865
 866    /// <summary>
 867    /// Attempts to build exact anchors between two centered capsules expressed
 868    /// by scalar rigid-frame rotations.
 869    /// </summary>
 870    public static bool TryGetCenteredCapsulesContact(
 871        Vector2d firstCenter,
 872        Fixed64 firstRotation,
 873        Fixed64 firstAxisLength,
 874        Fixed64 firstRadius,
 875        Vector2d secondCenter,
 876        Fixed64 secondRotation,
 877        Fixed64 secondAxisLength,
 878        Fixed64 secondRadius,
 879        Vector2d fallbackNormal,
 880        out FixedContactAnchors2d contact)
 881    {
 2882        ValidateRotatedCapsule(firstAxisLength, firstRadius);
 2883        ValidateRotatedCapsule(secondAxisLength, secondRadius);
 2884        if (!fallbackNormal.IsNormalized())
 885        {
 1886            throw new ArgumentException(
 1887                "Fallback normal must be normalized.",
 1888                nameof(fallbackNormal));
 889        }
 890
 1891        return WideFiniteAxisIntersection.TryGetCenteredCapsulesContact(
 1892            firstCenter,
 1893            firstRotation,
 1894            GetRotatedPositiveYAxis(firstRotation),
 1895            firstAxisLength,
 1896            firstRadius,
 1897            secondCenter,
 1898            secondRotation,
 1899            GetRotatedPositiveYAxis(secondRotation),
 1900            secondAxisLength,
 1901            secondRadius,
 1902            fallbackNormal,
 1903            out contact);
 904    }
 905
 906    /// <summary>
 907    /// Finds the minimum translation that separates a centered rotated capsule
 908    /// from a closed convex polygon represented by origin-relative offsets.
 909    /// </summary>
 910    public static bool TryGetCenteredCapsuleConvexMinimumTranslation(
 911        Vector2d center,
 912        Fixed64 rotation,
 913        Fixed64 axisLength,
 914        Fixed64 radius,
 915        Vector2d convexOrigin,
 916        ReadOnlySpan<Vector2d> convexVertexOffsets,
 917        out Vector2d normal,
 918        out Fixed64 depth)
 919    {
 2920        ValidateRotatedCapsule(axisLength, radius);
 2921        if (convexVertexOffsets.Length < 3)
 922        {
 1923            throw new ArgumentException(
 1924                "A convex polygon requires at least three vertex offsets.",
 1925                nameof(convexVertexOffsets));
 926        }
 927
 1928        return WideCenteredCapsule2dRelations.TryGetMinimumTranslation(
 1929            center,
 1930            GetRotatedPositiveYAxis(rotation),
 1931            axisLength,
 1932            radius,
 1933            convexOrigin,
 1934            convexVertexOffsets,
 1935            out normal,
 1936            out depth);
 937    }
 938
 939    /// <summary>
 940    /// Finds the first distance where a translated centered rotated capsule
 941    /// intersects an endpoint-authored capsule axis.
 942    /// </summary>
 943    public static bool TryGetSweptCenteredCapsuleSegmentFirstDistance(
 944        Vector2d center,
 945        Fixed64 rotation,
 946        Fixed64 axisLength,
 947        Fixed64 radius,
 948        Vector2d direction,
 949        Fixed64 maximumDistance,
 950        FixedSegment2d targetAxis,
 951        Fixed64 targetRadius,
 952        out Fixed64 distance,
 953        out Vector2d normal)
 954    {
 1955        ValidateSweep(
 1956            Vector2d.Forward,
 1957            axisLength,
 1958            radius,
 1959            direction,
 1960            maximumDistance,
 1961            targetRadius);
 1962        return WideFiniteAxisIntersection.TryGetSweptCenteredCapsuleSegmentFirstDistance(
 1963            center,
 1964            GetRotatedPositiveYAxis(rotation),
 1965            axisLength,
 1966            radius,
 1967            direction,
 1968            maximumDistance,
 1969            targetAxis,
 1970            targetRadius,
 1971            out distance,
 1972            out normal);
 973    }
 974
 975    /// <summary>
 976    /// Finds the first distance where a translated centered rotated capsule
 977    /// intersects another centered rotated capsule.
 978    /// </summary>
 979    public static bool TryGetSweptCenteredCapsulesFirstDistance(
 980        Vector2d center,
 981        Fixed64 rotation,
 982        Fixed64 axisLength,
 983        Fixed64 radius,
 984        Vector2d direction,
 985        Fixed64 maximumDistance,
 986        Vector2d targetCenter,
 987        Fixed64 targetRotation,
 988        Fixed64 targetAxisLength,
 989        Fixed64 targetRadius,
 990        out Fixed64 distance,
 991        out Vector2d normal)
 992    {
 1993        ValidateSweep(
 1994            Vector2d.Forward,
 1995            axisLength,
 1996            radius,
 1997            direction,
 1998            maximumDistance,
 1999            targetRadius);
 11000        ValidateCenteredAxis(Vector2d.Forward, targetAxisLength);
 11001        return WideFiniteAxisIntersection.TryGetSweptCenteredCapsulesFirstDistance(
 11002            center,
 11003            GetRotatedPositiveYAxis(rotation),
 11004            axisLength,
 11005            radius,
 11006            direction,
 11007            maximumDistance,
 11008            targetCenter,
 11009            GetRotatedPositiveYAxis(targetRotation),
 11010            targetAxisLength,
 11011            targetRadius,
 11012            out distance,
 11013            out normal);
 1014    }
 1015
 1016    /// <summary>
 1017    /// Finds the physical-distance interval where this segment intersects a
 1018    /// centered rotated capsule.
 1019    /// </summary>
 1020    public readonly bool TryGetCapsuleIntersectionDistanceInterval(
 1021        Vector2d center,
 1022        Fixed64 rotation,
 1023        Fixed64 axisLength,
 1024        Fixed64 radius,
 1025        Fixed64 radiusExpansion,
 1026        Fixed64 totalDistance,
 1027        out Fixed64 entryDistance,
 1028        out Fixed64 exitDistance,
 1029        out bool startContained,
 1030        out bool endContainedStrict)
 1031    {
 21032        ValidateTotalDistance(totalDistance);
 21033        ValidateRotatedCapsule(axisLength, radius);
 21034        if (radiusExpansion < Fixed64.Zero)
 11035            throw new ArgumentOutOfRangeException(nameof(radiusExpansion));
 1036
 11037        return WideFiniteAxisIntersection.TryGetCapsuleDistanceInterval(
 11038            this,
 11039            center,
 11040            GetRotatedPositiveYAxis(rotation),
 11041            axisLength,
 11042            radius,
 11043            radiusExpansion,
 11044            totalDistance,
 11045            out entryDistance,
 11046            out exitDistance,
 11047            out startContained,
 11048            out endContainedStrict);
 1049    }
 1050
 1051    private static Vector2d GetRotatedPositiveYAxis(Fixed64 rotation) =>
 181052        new(-FixedMath.Sin(rotation), FixedMath.Cos(rotation));
 1053
 1054    private static void ValidateRotatedCapsule(
 1055        Fixed64 axisLength,
 1056        Fixed64 radius)
 1057    {
 221058        ValidateCenteredAxis(Vector2d.Forward, axisLength);
 221059        if (radius < Fixed64.Zero)
 11060            throw new ArgumentOutOfRangeException(nameof(radius));
 211061    }
 1062}

/home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Primitives/Segments/FixedSegment2d.ConvexQueries.cs

#LineLine coverage
 1//=======================================================================
 2// FixedSegment2d.ConvexQueries.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024–present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9
 10namespace FixedMathSharp.Geometry;
 11
 12/// <content>
 13/// Contains centered-capsule versus convex-polygon contact and sweep queries.
 14/// </content>
 15public partial struct FixedSegment2d
 16{
 17    /// <summary>
 18    /// Finds the minimum translation that separates a conceptual centered
 19    /// capsule from a closed convex polygon represented by an origin and
 20    /// origin-relative vertex offsets.
 21    /// </summary>
 22    /// <remarks>
 23    /// Offsets must be supplied in boundary order. Exact depth ties retain the
 24    /// first authored edge axis, and exact direction ties retain the first
 25    /// authored vertex. Neither shape's conceptual world vertices need to be
 26    /// representable.
 27    /// </remarks>
 28    /// <returns>
 29    /// <see langword="true"/> when the shapes overlap, including tangency;
 30    /// otherwise <see langword="false"/> and both outputs are zero.
 31    /// </returns>
 32    public static bool TryGetCenteredCapsuleConvexMinimumTranslation(
 33        Vector2d center,
 34        Vector2d axisDirection,
 35        Fixed64 axisLength,
 36        Fixed64 radius,
 37        Vector2d convexOrigin,
 38        ReadOnlySpan<Vector2d> convexVertexOffsets,
 39        out Vector2d normal,
 40        out Fixed64 depth)
 41    {
 942        ValidateCenteredAxis(axisDirection, axisLength);
 843        if (radius < Fixed64.Zero)
 144            throw new ArgumentOutOfRangeException(nameof(radius));
 745        if (convexVertexOffsets.Length < 3)
 146            throw new ArgumentException(
 147                "A convex polygon requires at least three vertex offsets.",
 148                nameof(convexVertexOffsets));
 49
 650        return WideCenteredCapsule2dRelations.TryGetMinimumTranslation(
 651            center,
 652            axisDirection,
 653            axisLength,
 654            radius,
 655            convexOrigin,
 656            convexVertexOffsets,
 657            out normal,
 658            out depth);
 59    }
 60
 61    /// <summary>
 62    /// Finds the minimum translation that separates a conceptual centered
 63    /// capsule from a rotated closed convex polygon.
 64    /// </summary>
 65    public static bool TryGetCenteredCapsuleConvexMinimumTranslation(
 66        Vector2d center,
 67        Vector2d axisDirection,
 68        Fixed64 axisLength,
 69        Fixed64 radius,
 70        Vector2d convexOrigin,
 71        Fixed64 convexRotation,
 72        ReadOnlySpan<Vector2d> convexVertexOffsets,
 73        out Vector2d normal,
 74        out Fixed64 depth)
 75    {
 376        ValidateCenteredAxis(axisDirection, axisLength);
 377        if (radius < Fixed64.Zero)
 178            throw new ArgumentOutOfRangeException(nameof(radius));
 279        if (convexVertexOffsets.Length < 3)
 80        {
 181            throw new ArgumentException(
 182                "A convex polygon requires at least three vertex offsets.",
 183                nameof(convexVertexOffsets));
 84        }
 85
 186        return WideCenteredCapsule2dRelations.TryGetMinimumTranslation(
 187            center,
 188            axisDirection,
 189            axisLength,
 190            radius,
 191            convexOrigin,
 192            convexRotation,
 193            convexVertexOffsets,
 194            out normal,
 195            out depth);
 96    }
 97
 98    /// <summary>
 99    /// Attempts to build contact anchors between a conceptual centered capsule
 100    /// and a rotated closed convex polygon.
 101    /// </summary>
 102    /// <remarks>
 103    /// <paramref name="localCapsuleAxisDirection"/> is expressed in the
 104    /// capsule frame. Returned capsule anchors retain their axial and radial
 105    /// feature terms separately.
 106    /// </remarks>
 107    public static bool TryGetCenteredCapsuleConvexContacts(
 108        Vector2d capsuleCenter,
 109        Fixed64 capsuleRotation,
 110        Vector2d localCapsuleAxisDirection,
 111        Fixed64 capsuleAxisLength,
 112        Fixed64 capsuleRadius,
 113        Vector2d convexOrigin,
 114        Fixed64 convexRotation,
 115        ReadOnlySpan<Vector2d> convexVertexOffsets,
 116        Span<FixedPointAnchor2d> capsuleContacts,
 117        Span<FixedPointAnchor2d> convexContacts,
 118        out int contactCount,
 119        out Vector2d normal,
 120        out Fixed64 depth,
 121        out bool depthIsClamped)
 122    {
 24123        ValidateCenteredAxis(localCapsuleAxisDirection, capsuleAxisLength);
 24124        if (capsuleRadius < Fixed64.Zero)
 1125            throw new ArgumentOutOfRangeException(nameof(capsuleRadius));
 23126        if (convexVertexOffsets.Length < 3)
 127        {
 1128            throw new ArgumentException(
 1129                "A convex polygon requires at least three vertex offsets.",
 1130                nameof(convexVertexOffsets));
 131        }
 22132        if (capsuleContacts.Length < 2)
 133        {
 1134            throw new ArgumentException(
 1135                "Contact output requires capacity for two anchors.",
 1136                nameof(capsuleContacts));
 137        }
 21138        if (convexContacts.Length < 2)
 139        {
 1140            throw new ArgumentException(
 1141                "Contact output requires capacity for two anchors.",
 1142                nameof(convexContacts));
 143        }
 144
 20145        return WideCenteredCapsule2dRelations.TryGetContacts(
 20146            capsuleCenter,
 20147            capsuleRotation,
 20148            localCapsuleAxisDirection,
 20149            capsuleAxisLength,
 20150            capsuleRadius,
 20151            convexOrigin,
 20152            convexRotation,
 20153            convexVertexOffsets,
 20154            capsuleContacts,
 20155            convexContacts,
 20156            out contactCount,
 20157            out normal,
 20158            out depth,
 20159            out depthIsClamped);
 160    }
 161
 162    /// <summary>
 163    /// Finds the first distance where a translated conceptual centered
 164    /// capsule intersects an endpoint-authored capsule axis.
 165    /// </summary>
 166    public static bool TryGetSweptCenteredCapsuleSegmentFirstDistance(
 167        Vector2d center,
 168        Vector2d axisDirection,
 169        Fixed64 axisLength,
 170        Fixed64 radius,
 171        Vector2d direction,
 172        Fixed64 maximumDistance,
 173        FixedSegment2d targetAxis,
 174        Fixed64 targetRadius,
 175        out Fixed64 distance,
 176        out Vector2d normal)
 177    {
 8178        ValidateSweep(
 8179            axisDirection,
 8180            axisLength,
 8181            radius,
 8182            direction,
 8183            maximumDistance,
 8184            targetRadius);
 5185        return WideFiniteAxisIntersection.TryGetSweptCenteredCapsuleSegmentFirstDistance(
 5186            center,
 5187            axisDirection,
 5188            axisLength,
 5189            radius,
 5190            direction,
 5191            maximumDistance,
 5192            targetAxis,
 5193            targetRadius,
 5194            out distance,
 5195            out normal);
 196    }
 197
 198    /// <summary>
 199    /// Finds the first distance where a translated conceptual centered
 200    /// capsule intersects another conceptual centered capsule.
 201    /// </summary>
 202    public static bool TryGetSweptCenteredCapsulesFirstDistance(
 203        Vector2d center,
 204        Vector2d axisDirection,
 205        Fixed64 axisLength,
 206        Fixed64 radius,
 207        Vector2d direction,
 208        Fixed64 maximumDistance,
 209        Vector2d targetCenter,
 210        Vector2d targetAxisDirection,
 211        Fixed64 targetAxisLength,
 212        Fixed64 targetRadius,
 213        out Fixed64 distance,
 214        out Vector2d normal)
 215    {
 11216        ValidateSweep(
 11217            axisDirection,
 11218            axisLength,
 11219            radius,
 11220            direction,
 11221            maximumDistance,
 11222            targetRadius);
 10223        ValidateCenteredAxis(
 10224            targetAxisDirection,
 10225            targetAxisLength,
 10226            nameof(targetAxisDirection),
 10227            nameof(targetAxisLength));
 10228        return WideFiniteAxisIntersection.TryGetSweptCenteredCapsulesFirstDistance(
 10229            center,
 10230            axisDirection,
 10231            axisLength,
 10232            radius,
 10233            direction,
 10234            maximumDistance,
 10235            targetCenter,
 10236            targetAxisDirection,
 10237            targetAxisLength,
 10238            targetRadius,
 10239            out distance,
 10240            out normal);
 241    }
 242
 243    private static void ValidateSweep(
 244        Vector2d axisDirection,
 245        Fixed64 axisLength,
 246        Fixed64 radius,
 247        Vector2d direction,
 248        Fixed64 maximumDistance,
 249        Fixed64 targetRadius)
 250    {
 21251        ValidateCenteredAxis(axisDirection, axisLength);
 21252        if (radius < Fixed64.Zero)
 1253            throw new ArgumentOutOfRangeException(nameof(radius));
 20254        if (!direction.IsNormalized())
 1255            throw new ArgumentException("Sweep direction must be normalized.", nameof(direction));
 19256        if (maximumDistance < Fixed64.Zero)
 1257            throw new ArgumentOutOfRangeException(nameof(maximumDistance));
 18258        if (targetRadius < Fixed64.Zero)
 1259            throw new ArgumentOutOfRangeException(nameof(targetRadius));
 17260    }
 261}

/home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Primitives/Segments/FixedSegment2d.cs

#LineLine coverage
 1//=======================================================================
 2// FixedSegment2d.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024–present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9using System.Runtime.CompilerServices;
 10using System.Text.Json.Serialization;
 11using MemoryPack;
 12
 13namespace FixedMathSharp.Geometry;
 14
 15/// <summary>
 16/// Represents a finite line segment in two-dimensional fixed-point space.
 17/// </summary>
 18[Serializable]
 19[MemoryPackable]
 20public partial struct FixedSegment2d : IEquatable<FixedSegment2d>
 21{
 22    #region Fields
 23
 24    /// <summary>
 25    /// The start point of the segment.
 26    /// </summary>
 27    [JsonInclude]
 28    [MemoryPackOrder(0)]
 29    public Vector2d Start;
 30
 31    /// <summary>
 32    /// The end point of the segment.
 33    /// </summary>
 34    [JsonInclude]
 35    [MemoryPackOrder(1)]
 36    public Vector2d End;
 37
 38    #endregion
 39
 40    #region Constructors
 41
 42    /// <summary>
 43    /// Initializes a new segment from start and end points.
 44    /// </summary>
 45    [JsonConstructor]
 46    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 47    public FixedSegment2d(Vector2d start, Vector2d end)
 48    {
 799149        Start = start;
 799150        End = end;
 799151    }
 52
 53    #endregion
 54
 55    #region Properties
 56
 57    /// <summary>
 58    /// The vector from <see cref="Start"/> to <see cref="End"/>.
 59    /// </summary>
 60    [JsonIgnore]
 61    [MemoryPackIgnore]
 62    public Vector2d Delta
 63    {
 64        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 1065        get => End - Start;
 66    }
 67
 68    /// <summary>
 69    /// The segment length.
 70    /// </summary>
 71    [JsonIgnore]
 72    [MemoryPackIgnore]
 73    public Fixed64 Length
 74    {
 75        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 276        get => Delta.Magnitude;
 77    }
 78
 79    /// <summary>
 80    /// The squared segment length.
 81    /// </summary>
 82    [JsonIgnore]
 83    [MemoryPackIgnore]
 84    public Fixed64 LengthSquared
 85    {
 86        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 287        get => Delta.MagnitudeSquared;
 88    }
 89
 90    /// <summary>
 91    /// The normalized axis-aligned area that contains this segment.
 92    /// </summary>
 93    [JsonIgnore]
 94    [MemoryPackIgnore]
 95    public FixedBoundArea Bounds
 96    {
 97        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 398        get => FixedBoundArea.FromMinMax(Start, End);
 99    }
 100
 101    #endregion
 102
 103    #region Spatial Queries
 104
 105    /// <summary>
 106    /// Finds the closest point on this finite segment to the supplied point.
 107    /// </summary>
 108    /// <remarks>
 109    /// Zero-length segments deterministically return <see cref="Start"/>.
 110    /// </remarks>
 111    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 86112    public Vector2d ClosestPoint(Vector2d point) => Vector2d.ClosestPointOnLineSegment(point, Start, End);
 113
 114    /// <summary>
 115    /// Computes the squared distance from the supplied point to this finite segment.
 116    /// </summary>
 117    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 118    public Fixed64 DistanceSquared(Vector2d point)
 119    {
 30120        return Vector2d.DistanceSquared(point, ClosestPoint(point));
 121    }
 122
 123    /// <summary>
 124    /// Finds the closed parameter interval where this segment intersects a capsule.
 125    /// </summary>
 126    /// <remarks>
 127    /// The capsule is described by its finite center-line segment and radius.
 128    /// Returned parameters are clamped to [0, 1]. A zero-length capsule axis is
 129    /// treated as a circle.
 130    /// </remarks>
 131    /// <exception cref="ArgumentOutOfRangeException">
 132    /// Thrown when <paramref name="radius"/> is negative.
 133    /// </exception>
 134    public readonly bool TryGetCapsuleIntersectionInterval(
 135        FixedSegment2d capsuleAxis,
 136        Fixed64 radius,
 137        out Fixed64 entryParameter,
 138        out Fixed64 exitParameter) =>
 3139        TryGetCapsuleIntersectionInterval(
 3140            capsuleAxis,
 3141            radius,
 3142            Fixed64.Zero,
 3143            out entryParameter,
 3144            out exitParameter);
 145
 146    /// <summary>
 147    /// Finds the closed parameter interval where this segment intersects a radially
 148    /// expanded capsule.
 149    /// </summary>
 150    /// <remarks>
 151    /// The authored radius and sweep expansion remain separate until the exact
 152    /// finite-axis solve. Returned parameters are clamped to [0, 1]. A zero-length
 153    /// capsule axis is treated as a circle.
 154    /// </remarks>
 155    /// <exception cref="ArgumentOutOfRangeException">
 156    /// Thrown when <paramref name="radius"/> or <paramref name="radiusExpansion"/>
 157    /// is negative.
 158    /// </exception>
 159    public readonly bool TryGetCapsuleIntersectionInterval(
 160        FixedSegment2d capsuleAxis,
 161        Fixed64 radius,
 162        Fixed64 radiusExpansion,
 163        out Fixed64 entryParameter,
 164        out Fixed64 exitParameter) =>
 5165        TryGetCapsuleIntersectionInterval(
 5166            capsuleAxis,
 5167            radius,
 5168            radiusExpansion,
 5169            out entryParameter,
 5170            out exitParameter,
 5171            out _,
 5172            out _);
 173
 174    /// <summary>
 175    /// Finds the closed parameter interval where this segment intersects a capsule
 176    /// and reports exact endpoint containment.
 177    /// </summary>
 178    /// <remarks>
 179    /// <paramref name="startContained"/> is inclusive of the capsule boundary.
 180    /// <paramref name="endContainedStrict"/> is true only for the mathematical
 181    /// interior. Both classifications use the wide solve inputs rather than rounded
 182    /// parameters or reconstructed points. A zero-length capsule axis is treated as
 183    /// a circle.
 184    /// </remarks>
 185    /// <exception cref="ArgumentOutOfRangeException">
 186    /// Thrown when <paramref name="radius"/> or <paramref name="radiusExpansion"/>
 187    /// is negative.
 188    /// </exception>
 189    public readonly bool TryGetCapsuleIntersectionInterval(
 190        FixedSegment2d capsuleAxis,
 191        Fixed64 radius,
 192        Fixed64 radiusExpansion,
 193        out Fixed64 entryParameter,
 194        out Fixed64 exitParameter,
 195        out bool startContained,
 196        out bool endContainedStrict)
 197    {
 9198        if (radius < Fixed64.Zero)
 1199            throw new ArgumentOutOfRangeException(nameof(radius));
 8200        if (radiusExpansion < Fixed64.Zero)
 1201            throw new ArgumentOutOfRangeException(nameof(radiusExpansion));
 202
 7203        return WideFiniteAxisIntersection.TryGetCapsuleInterval(
 7204            this,
 7205            capsuleAxis,
 7206            radius,
 7207            radiusExpansion,
 7208            out entryParameter,
 7209            out exitParameter,
 7210            out startContained,
 7211            out endContainedStrict);
 212    }
 213
 214    /// <summary>
 215    /// Finds the closed parameter interval where this segment intersects a
 216    /// centered capsule.
 217    /// </summary>
 218    /// <exception cref="ArgumentException">
 219    /// Thrown when <paramref name="axisDirection"/> is zero or not normalized.
 220    /// </exception>
 221    /// <exception cref="ArgumentOutOfRangeException">
 222    /// Thrown when <paramref name="axisLength"/> or
 223    /// <paramref name="radius"/> is negative.
 224    /// </exception>
 225    public readonly bool TryGetCapsuleIntersectionInterval(
 226        Vector2d center,
 227        Vector2d axisDirection,
 228        Fixed64 axisLength,
 229        Fixed64 radius,
 230        out Fixed64 entryParameter,
 231        out Fixed64 exitParameter) =>
 142232        TryGetCapsuleIntersectionInterval(
 142233            center,
 142234            axisDirection,
 142235            axisLength,
 142236            radius,
 142237            Fixed64.Zero,
 142238            out entryParameter,
 142239            out exitParameter);
 240
 241    /// <summary>
 242    /// Finds the closed parameter interval where this segment intersects a
 243    /// centered, radially expanded capsule.
 244    /// </summary>
 245    /// <exception cref="ArgumentException">
 246    /// Thrown when <paramref name="axisDirection"/> is zero or not normalized.
 247    /// </exception>
 248    /// <exception cref="ArgumentOutOfRangeException">
 249    /// Thrown when <paramref name="axisLength"/>,
 250    /// <paramref name="radius"/> or <paramref name="radiusExpansion"/> is
 251    /// negative.
 252    /// </exception>
 253    public readonly bool TryGetCapsuleIntersectionInterval(
 254        Vector2d center,
 255        Vector2d axisDirection,
 256        Fixed64 axisLength,
 257        Fixed64 radius,
 258        Fixed64 radiusExpansion,
 259        out Fixed64 entryParameter,
 260        out Fixed64 exitParameter) =>
 144261        TryGetCapsuleIntersectionInterval(
 144262            center,
 144263            axisDirection,
 144264            axisLength,
 144265            radius,
 144266            radiusExpansion,
 144267            out entryParameter,
 144268            out exitParameter,
 144269            out _,
 144270            out _);
 271
 272    /// <summary>
 273    /// Finds the closed parameter interval where this segment intersects a
 274    /// centered, radially expanded capsule and reports exact endpoint
 275    /// containment.
 276    /// </summary>
 277    /// <remarks>
 278    /// The normalized axis defines the conceptual center-line endpoints as
 279    /// <c>center +/- axisDirection * (axisLength / 2)</c> without constructing or
 280    /// narrowing either endpoint. <paramref name="startContained"/> includes the
 281    /// boundary; <paramref name="endContainedStrict"/> excludes it.
 282    /// </remarks>
 283    /// <exception cref="ArgumentException">
 284    /// Thrown when <paramref name="axisDirection"/> is zero or not normalized.
 285    /// </exception>
 286    /// <exception cref="ArgumentOutOfRangeException">
 287    /// Thrown when <paramref name="axisLength"/>,
 288    /// <paramref name="radius"/> or <paramref name="radiusExpansion"/> is
 289    /// negative.
 290    /// </exception>
 291    public readonly bool TryGetCapsuleIntersectionInterval(
 292        Vector2d center,
 293        Vector2d axisDirection,
 294        Fixed64 axisLength,
 295        Fixed64 radius,
 296        Fixed64 radiusExpansion,
 297        out Fixed64 entryParameter,
 298        out Fixed64 exitParameter,
 299        out bool startContained,
 300        out bool endContainedStrict)
 301    {
 147302        if (!axisDirection.IsNormalized())
 1303            throw new ArgumentException("Capsule axis direction must be normalized.", nameof(axisDirection));
 146304        if (axisLength < Fixed64.Zero)
 1305            throw new ArgumentOutOfRangeException(nameof(axisLength));
 145306        if (radius < Fixed64.Zero)
 1307            throw new ArgumentOutOfRangeException(nameof(radius));
 144308        if (radiusExpansion < Fixed64.Zero)
 1309            throw new ArgumentOutOfRangeException(nameof(radiusExpansion));
 310
 143311        return WideFiniteAxisIntersection.TryGetCapsuleInterval(
 143312            this,
 143313            center,
 143314            axisDirection,
 143315            axisLength,
 143316            radius,
 143317            radiusExpansion,
 143318            out entryParameter,
 143319            out exitParameter,
 143320            out startContained,
 143321            out endContainedStrict);
 322    }
 323
 324    /// <summary>
 325    /// Attempts to find the unique intersection point shared by this segment and another segment.
 326    /// </summary>
 327    /// <remarks>
 328    /// Closed endpoint touches and coincident point segments have one unique intersection.
 329    /// Collinear segments with a positive-length overlap do not.
 330    /// </remarks>
 331    public readonly bool TryGetUniqueIntersection(
 332        FixedSegment2d other,
 333        out Fixed64 thisParameter)
 334    {
 20335        return TryGetUniqueIntersection(other, out thisParameter, out _);
 336    }
 337
 338    /// <summary>
 339    /// Returns the closest finite points on this segment and another segment.
 340    /// </summary>
 341    /// <remarks>
 342    /// Exact shared endpoints are returned in this-start, this-end, other-start,
 343    /// other-end order before parameterized interior intersections. Remaining endpoint
 344    /// projections use the same order, and exact distance ties keep the first candidate.
 345    /// </remarks>
 346    public readonly (Vector2d ThisPoint, Vector2d OtherPoint) GetClosestPoints(FixedSegment2d other)
 347    {
 15348        if (PointOnSegment(Start, other))
 2349            return (Start, Start);
 13350        if (PointOnSegment(End, other))
 2351            return (End, End);
 11352        if (PointOnSegment(other.Start, this))
 1353            return (other.Start, other.Start);
 10354        if (PointOnSegment(other.End, this))
 1355            return (other.End, other.End);
 356
 9357        if (TryGetUniqueIntersection(other, out Fixed64 thisParameter, out Fixed64 otherParameter))
 358        {
 1359            return (Interpolate(this, thisParameter), Interpolate(other, otherParameter));
 360        }
 361
 8362        Vector2d thisPoint = Start;
 8363        Vector2d otherPoint = other.ClosestPoint(Start);
 364
 8365        ConsiderClosestCandidate(End, other.ClosestPoint(End), ref thisPoint, ref otherPoint);
 8366        ConsiderClosestCandidate(
 8367            Vector2d.ClosestPointOnLineSegment(other.Start, Start, End),
 8368            other.Start,
 8369            ref thisPoint,
 8370            ref otherPoint);
 8371        ConsiderClosestCandidate(
 8372            Vector2d.ClosestPointOnLineSegment(other.End, Start, End),
 8373            other.End,
 8374            ref thisPoint,
 8375            ref otherPoint);
 376
 8377        return (thisPoint, otherPoint);
 378    }
 379
 380    private readonly bool TryGetUniqueIntersection(
 381        FixedSegment2d other,
 382        out Fixed64 thisParameter,
 383        out Fixed64 otherParameter)
 384    {
 29385        bool thisIsPoint = Start == End;
 29386        bool otherIsPoint = other.Start == other.End;
 387
 29388        if (thisIsPoint)
 389        {
 6390            thisParameter = Fixed64.Zero;
 6391            if (!PointOnSegment(Start, other))
 392            {
 4393                otherParameter = default;
 4394                return false;
 395            }
 396
 2397            otherParameter = otherIsPoint
 2398                ? Fixed64.Zero
 2399                : Vector2d.GetClosestPointOnLineSegmentParameter(Start, other.Start, other.End);
 2400            return true;
 401        }
 402
 23403        if (otherIsPoint)
 404        {
 2405            otherParameter = Fixed64.Zero;
 2406            if (!PointOnSegment(other.Start, this))
 407            {
 1408                thisParameter = default;
 1409                return false;
 410            }
 411
 1412            thisParameter = Vector2d.GetClosestPointOnLineSegmentParameter(other.Start, Start, End);
 1413            return true;
 414        }
 415
 21416        Signed192 determinant = WideGeometry.GetDifferenceCrossProduct2D(
 21417            End.X, Start.X, End.Y, Start.Y,
 21418            other.End.X, other.Start.X, other.End.Y, other.Start.Y);
 21419        if (!determinant.IsZero)
 420        {
 14421            Signed192 thisNumerator = WideGeometry.GetDifferenceCrossProduct2D(
 14422                other.Start.X, Start.X, other.Start.Y, Start.Y,
 14423                other.End.X, other.Start.X, other.End.Y, other.Start.Y);
 14424            Signed192 otherNumerator = WideGeometry.GetDifferenceCrossProduct2D(
 14425                other.Start.X, Start.X, other.Start.Y, Start.Y,
 14426                End.X, Start.X, End.Y, Start.Y);
 427
 14428            if (Fixed64.TryGetUnitIntervalRatio(thisNumerator, determinant, out thisParameter)
 14429                && Fixed64.TryGetUnitIntervalRatio(otherNumerator, determinant, out otherParameter))
 430            {
 10431                return true;
 432            }
 433
 4434            thisParameter = default;
 4435            otherParameter = default;
 4436            return false;
 437        }
 438
 7439        Signed192 collinearity = WideGeometry.GetDifferenceCrossProduct2D(
 7440            other.Start.X, Start.X, other.Start.Y, Start.Y,
 7441            End.X, Start.X, End.Y, Start.Y);
 7442        if (!collinearity.IsZero)
 443        {
 3444            thisParameter = default;
 3445            otherParameter = default;
 3446            return false;
 447        }
 448
 4449        int sharedPointCount = 0;
 4450        Vector2d sharedPoint = default;
 4451        ConsiderSharedEndpoint(Start, this, other, ref sharedPointCount, ref sharedPoint);
 4452        ConsiderSharedEndpoint(End, this, other, ref sharedPointCount, ref sharedPoint);
 4453        ConsiderSharedEndpoint(other.Start, this, other, ref sharedPointCount, ref sharedPoint);
 4454        ConsiderSharedEndpoint(other.End, this, other, ref sharedPointCount, ref sharedPoint);
 455
 4456        if (sharedPointCount == 1)
 457        {
 1458            thisParameter = Vector2d.GetClosestPointOnLineSegmentParameter(sharedPoint, Start, End);
 1459            otherParameter = Vector2d.GetClosestPointOnLineSegmentParameter(sharedPoint, other.Start, other.End);
 1460            return true;
 461        }
 462
 3463        thisParameter = default;
 3464        otherParameter = default;
 3465        return false;
 466    }
 467
 468    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 469    private static Vector2d Interpolate(FixedSegment2d segment, Fixed64 parameter)
 470    {
 2471        return new Vector2d(
 2472            FixedMath.Lerp(segment.Start.X, segment.End.X, parameter),
 2473            FixedMath.Lerp(segment.Start.Y, segment.End.Y, parameter));
 474    }
 475
 476    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 477    private static bool PointOnSegment(Vector2d point, FixedSegment2d segment)
 478    {
 85479        Signed192 cross = WideGeometry.GetDifferenceCrossProduct2D(
 85480            point.X, segment.Start.X, point.Y, segment.Start.Y,
 85481            segment.End.X, segment.Start.X, segment.End.Y, segment.Start.Y);
 85482        if (!cross.IsZero)
 34483            return false;
 484
 51485        long pointX = point.X.m_rawValue;
 51486        long pointY = point.Y.m_rawValue;
 51487        long startX = segment.Start.X.m_rawValue;
 51488        long startY = segment.Start.Y.m_rawValue;
 51489        long endX = segment.End.X.m_rawValue;
 51490        long endY = segment.End.Y.m_rawValue;
 51491        return pointX >= Math.Min(startX, endX)
 51492            && pointX <= Math.Max(startX, endX)
 51493            && pointY >= Math.Min(startY, endY)
 51494            && pointY <= Math.Max(startY, endY);
 495    }
 496
 497    private static void ConsiderSharedEndpoint(
 498        Vector2d candidate,
 499        FixedSegment2d first,
 500        FixedSegment2d second,
 501        ref int sharedPointCount,
 502        ref Vector2d sharedPoint)
 503    {
 16504        if (!PointOnSegment(candidate, first)
 16505            || !PointOnSegment(candidate, second)
 16506            || (sharedPointCount != 0 && candidate == sharedPoint))
 507        {
 9508            return;
 509        }
 510
 7511        sharedPoint = candidate;
 7512        sharedPointCount++;
 7513    }
 514
 515    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 516    private static void ConsiderClosestCandidate(
 517        Vector2d candidateThisPoint,
 518        Vector2d candidateOtherPoint,
 519        ref Vector2d thisPoint,
 520        ref Vector2d otherPoint)
 521    {
 24522        if (Vector2d.CompareDistanceSquared(
 24523            candidateThisPoint,
 24524            candidateOtherPoint,
 24525            thisPoint,
 24526            otherPoint) < 0)
 527        {
 3528            thisPoint = candidateThisPoint;
 3529            otherPoint = candidateOtherPoint;
 530        }
 24531    }
 532
 533    #endregion
 534
 535    #region Deconstruction
 536
 537    /// <summary>
 538    /// Deconstructs the segment into start and end points.
 539    /// </summary>
 540    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 541    public void Deconstruct(out Vector2d start, out Vector2d end)
 542    {
 1543        start = Start;
 1544        end = End;
 1545    }
 546
 547    #endregion
 548
 549    #region Operators
 550
 551    /// <summary>
 552    /// Determines whether two segments have the same ordered endpoints.
 553    /// </summary>
 554    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 2555    public static bool operator ==(FixedSegment2d left, FixedSegment2d right) => left.Equals(right);
 556
 557    /// <summary>
 558    /// Determines whether two segments have different ordered endpoints.
 559    /// </summary>
 560    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 2561    public static bool operator !=(FixedSegment2d left, FixedSegment2d right) => !left.Equals(right);
 562
 563    #endregion
 564
 565    #region Equality
 566
 567    /// <inheritdoc />
 568    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 569    public bool Equals(FixedSegment2d other)
 570    {
 11571        return Start == other.Start && End == other.End;
 572    }
 573
 574    /// <inheritdoc />
 575    public override bool Equals(object? obj)
 576    {
 2577        return obj is FixedSegment2d other && Equals(other);
 578    }
 579
 580    /// <inheritdoc />
 581    public override int GetHashCode()
 582    {
 583        unchecked
 584        {
 2585            int hash = 17;
 2586            hash = (hash * 31) + Start.StateHash;
 2587            hash = (hash * 31) + End.StateHash;
 2588            return hash;
 589        }
 590    }
 591
 592    #endregion
 593
 594    /// <summary>
 595    /// Finds the physical-distance interval where this segment intersects a
 596    /// circle, mapped to the caller-supplied total distance.
 597    /// </summary>
 598    public readonly bool TryGetCircleIntersectionDistanceInterval(
 599        FixedBoundCircle circle,
 600        Fixed64 totalDistance,
 601        out Fixed64 entryDistance,
 602        out Fixed64 exitDistance) =>
 4603        TryGetCircleIntersectionDistanceInterval(
 4604            circle,
 4605            Fixed64.Zero,
 4606            totalDistance,
 4607            out entryDistance,
 4608            out exitDistance,
 4609            out _,
 4610            out _);
 611
 612    /// <summary>
 613    /// Finds the physical-distance interval where this segment intersects a
 614    /// radially expanded circle and reports exact endpoint containment.
 615    /// </summary>
 616    /// <remarks>
 617    /// The exact segment interval maps to <c>[0, totalDistance]</c> with one
 618    /// final round-half-to-even conversion. Start containment is inclusive;
 619    /// end containment is strict and is classified before distance rounding.
 620    /// </remarks>
 621    public readonly bool TryGetCircleIntersectionDistanceInterval(
 622        FixedBoundCircle circle,
 623        Fixed64 radiusExpansion,
 624        Fixed64 totalDistance,
 625        out Fixed64 entryDistance,
 626        out Fixed64 exitDistance,
 627        out bool startContained,
 628        out bool endContainedStrict)
 629    {
 8630        ValidateTotalDistance(totalDistance);
 7631        if (radiusExpansion < Fixed64.Zero)
 1632            throw new ArgumentOutOfRangeException(nameof(radiusExpansion));
 633
 6634        return WideFiniteAxisIntersection.TryGetCircleDistanceInterval(
 6635            this,
 6636            circle,
 6637            radiusExpansion,
 6638            totalDistance,
 6639            out entryDistance,
 6640            out exitDistance,
 6641            out startContained,
 6642            out endContainedStrict);
 643    }
 644
 645    /// <summary>
 646    /// Finds the physical-distance interval where this segment intersects an
 647    /// endpoint-authored capsule.
 648    /// </summary>
 649    public readonly bool TryGetCapsuleIntersectionDistanceInterval(
 650        FixedSegment2d capsuleAxis,
 651        Fixed64 radius,
 652        Fixed64 totalDistance,
 653        out Fixed64 entryDistance,
 654        out Fixed64 exitDistance) =>
 19764655        TryGetCapsuleIntersectionDistanceInterval(
 19764656            capsuleAxis,
 19764657            radius,
 19764658            Fixed64.Zero,
 19764659            totalDistance,
 19764660            out entryDistance,
 19764661            out exitDistance,
 19764662            out _,
 19764663            out _);
 664
 665    /// <summary>
 666    /// Finds the physical-distance interval where this segment intersects an
 667    /// endpoint-authored, radially expanded capsule and reports exact endpoint
 668    /// containment.
 669    /// </summary>
 670    public readonly bool TryGetCapsuleIntersectionDistanceInterval(
 671        FixedSegment2d capsuleAxis,
 672        Fixed64 radius,
 673        Fixed64 radiusExpansion,
 674        Fixed64 totalDistance,
 675        out Fixed64 entryDistance,
 676        out Fixed64 exitDistance,
 677        out bool startContained,
 678        out bool endContainedStrict)
 679    {
 19768680        ValidateTotalDistance(totalDistance);
 19767681        if (radius < Fixed64.Zero)
 1682            throw new ArgumentOutOfRangeException(nameof(radius));
 19766683        if (radiusExpansion < Fixed64.Zero)
 1684            throw new ArgumentOutOfRangeException(nameof(radiusExpansion));
 685
 19765686        return WideFiniteAxisIntersection.TryGetCapsuleDistanceInterval(
 19765687            this,
 19765688            capsuleAxis,
 19765689            radius,
 19765690            radiusExpansion,
 19765691            totalDistance,
 19765692            out entryDistance,
 19765693            out exitDistance,
 19765694            out startContained,
 19765695            out endContainedStrict);
 696    }
 697
 698    /// <summary>
 699    /// Finds the physical-distance interval where this segment intersects a
 700    /// centered capsule.
 701    /// </summary>
 702    public readonly bool TryGetCapsuleIntersectionDistanceInterval(
 703        Vector2d center,
 704        Vector2d axisDirection,
 705        Fixed64 axisLength,
 706        Fixed64 radius,
 707        Fixed64 totalDistance,
 708        out Fixed64 entryDistance,
 709        out Fixed64 exitDistance) =>
 1710        TryGetCapsuleIntersectionDistanceInterval(
 1711            center,
 1712            axisDirection,
 1713            axisLength,
 1714            radius,
 1715            Fixed64.Zero,
 1716            totalDistance,
 1717            out entryDistance,
 1718            out exitDistance,
 1719            out _,
 1720            out _);
 721
 722    /// <summary>
 723    /// Finds the physical-distance interval where this segment intersects a
 724    /// centered, radially expanded capsule and reports exact endpoint
 725    /// containment.
 726    /// </summary>
 727    public readonly bool TryGetCapsuleIntersectionDistanceInterval(
 728        Vector2d center,
 729        Vector2d axisDirection,
 730        Fixed64 axisLength,
 731        Fixed64 radius,
 732        Fixed64 radiusExpansion,
 733        Fixed64 totalDistance,
 734        out Fixed64 entryDistance,
 735        out Fixed64 exitDistance,
 736        out bool startContained,
 737        out bool endContainedStrict)
 738    {
 8739        ValidateTotalDistance(totalDistance);
 8740        ValidateCenteredAxis(axisDirection, axisLength);
 6741        if (radius < Fixed64.Zero)
 1742            throw new ArgumentOutOfRangeException(nameof(radius));
 5743        if (radiusExpansion < Fixed64.Zero)
 1744            throw new ArgumentOutOfRangeException(nameof(radiusExpansion));
 745
 4746        return WideFiniteAxisIntersection.TryGetCapsuleDistanceInterval(
 4747            this,
 4748            center,
 4749            axisDirection,
 4750            axisLength,
 4751            radius,
 4752            radiusExpansion,
 4753            totalDistance,
 4754            out entryDistance,
 4755            out exitDistance,
 4756            out startContained,
 4757            out endContainedStrict);
 758    }
 759
 760    /// <summary>
 761    /// Reconstructs the point at an authored physical distance along this
 762    /// segment using one exact chord interpolation per coordinate.
 763    /// </summary>
 764    /// <remarks>
 765    /// This method does not normalize <see cref="Delta"/>. It therefore retains
 766    /// representable chord components that would round away in a normalized
 767    /// direction. The final coordinates use round-half-to-even.
 768    /// </remarks>
 769    /// <exception cref="ArgumentOutOfRangeException">
 770    /// Thrown when <paramref name="totalDistance"/> is negative, or when
 771    /// <paramref name="distance"/> is outside [0, <paramref name="totalDistance"/>].
 772    /// </exception>
 773    /// <exception cref="ArgumentException">
 774    /// Thrown when <paramref name="totalDistance"/> is zero and this segment is
 775    /// not a point.
 776    /// </exception>
 777    public readonly Vector2d GetPointAtDistance(Fixed64 distance, Fixed64 totalDistance)
 778    {
 9779        ValidateDistance(distance, totalDistance);
 7780        if (distance == Fixed64.Zero)
 2781            return Start;
 5782        if (distance == totalDistance)
 1783            return End;
 784
 4785        Signed192 distanceRaw = Signed192.Signed(distance.m_rawValue);
 4786        Signed192 totalDistanceRaw = Signed192.Signed(totalDistance.m_rawValue);
 4787        return new Vector2d(
 4788            WideGeometry.InterpolateCoordinate(Start.X, End.X, distanceRaw, totalDistanceRaw),
 4789            WideGeometry.InterpolateCoordinate(Start.Y, End.Y, distanceRaw, totalDistanceRaw));
 790    }
 791
 792    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 793    private readonly void ValidateDistance(Fixed64 distance, Fixed64 totalDistance)
 794    {
 9795        ValidateTotalDistance(totalDistance);
 8796        if (distance < Fixed64.Zero || distance > totalDistance)
 1797            throw new ArgumentOutOfRangeException(nameof(distance));
 7798    }
 799
 800    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 801    private readonly void ValidateTotalDistance(Fixed64 totalDistance)
 802    {
 19795803        if (totalDistance < Fixed64.Zero)
 2804            throw new ArgumentOutOfRangeException(nameof(totalDistance));
 19793805        if (totalDistance == Fixed64.Zero && Start != End)
 1806            throw new ArgumentException("Zero total distance requires a zero-length segment.", nameof(totalDistance));
 19792807    }
 808}

Methods/Properties

TryGetDistanceToCenteredAxis(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&)
TryGetDistanceBetweenCenteredAxes(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&)
DoCenteredCapsulesOverlap(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64)
TryGetCenteredCapsulesContact(FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Geometry.FixedContactAnchors2d&)
TryGetCenteredAxisEndpoint(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,System.Boolean,FixedMathSharp.Vector2d&)
TryGetCenteredCapsuleSupport(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d&)
GetCenteredCapsuleSupportAnchor(FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d)
GetDistanceToCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64)
TryGetDistanceToCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&)
ContainsPointInCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64)
ContainsPointInCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,System.Boolean)
ContainsPointInCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64)
ContainsPointInCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,System.Boolean)
TryGetSurfacePointOnCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d&)
TryGetSurfaceOffsetOnCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d&)
GetSurfaceAnchorOnCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d)
GetDirectionFromCenteredAxis(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64)
TryGetClosestPointsBetweenCenteredAxes(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d&,FixedMathSharp.Vector2d&)
ValidateCenteredAxis(FixedMathSharp.Vector2d,FixedMathSharp.Fixed64)
ValidateCenteredAxis(FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,System.String,System.String)
ContainsPointInCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64)
ContainsPointInCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64)
ContainsPointInCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,System.Boolean)
GetDirectionFromCenteredAxis(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64)
GetDistanceToCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64)
TryGetDistanceToCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&)
TryGetCenteredCapsuleSupport(FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d&)
TryGetSurfacePointOnCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d&)
TryGetSurfaceOffsetOnCenteredCapsule(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d&)
DoCenteredCapsulesOverlap(FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64)
TryGetCenteredCapsulesContact(FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Geometry.FixedContactAnchors2d&)
TryGetCenteredCapsuleConvexMinimumTranslation(FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,System.ReadOnlySpan`1<FixedMathSharp.Vector2d>,FixedMathSharp.Vector2d&,FixedMathSharp.Fixed64&)
TryGetSweptCenteredCapsuleSegmentFirstDistance(FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Geometry.FixedSegment2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Vector2d&)
TryGetSweptCenteredCapsulesFirstDistance(FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Vector2d&)
TryGetCapsuleIntersectionDistanceInterval(FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&,System.Boolean&,System.Boolean&)
GetRotatedPositiveYAxis(FixedMathSharp.Fixed64)
ValidateRotatedCapsule(FixedMathSharp.Fixed64,FixedMathSharp.Fixed64)
TryGetCenteredCapsuleConvexMinimumTranslation(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,System.ReadOnlySpan`1<FixedMathSharp.Vector2d>,FixedMathSharp.Vector2d&,FixedMathSharp.Fixed64&)
TryGetCenteredCapsuleConvexMinimumTranslation(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,System.ReadOnlySpan`1<FixedMathSharp.Vector2d>,FixedMathSharp.Vector2d&,FixedMathSharp.Fixed64&)
TryGetCenteredCapsuleConvexContacts(FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,System.ReadOnlySpan`1<FixedMathSharp.Vector2d>,System.Span`1<FixedMathSharp.Geometry.FixedPointAnchor2d>,System.Span`1<FixedMathSharp.Geometry.FixedPointAnchor2d>,System.Int32&,FixedMathSharp.Vector2d&,FixedMathSharp.Fixed64&,System.Boolean&)
TryGetSweptCenteredCapsuleSegmentFirstDistance(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Geometry.FixedSegment2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Vector2d&)
TryGetSweptCenteredCapsulesFirstDistance(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Vector2d&)
ValidateSweep(FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64)
.ctor(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d)
get_Delta()
get_Length()
get_LengthSquared()
get_Bounds()
ClosestPoint(FixedMathSharp.Vector2d)
DistanceSquared(FixedMathSharp.Vector2d)
TryGetCapsuleIntersectionInterval(FixedMathSharp.Geometry.FixedSegment2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&)
TryGetCapsuleIntersectionInterval(FixedMathSharp.Geometry.FixedSegment2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&)
TryGetCapsuleIntersectionInterval(FixedMathSharp.Geometry.FixedSegment2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&,System.Boolean&,System.Boolean&)
TryGetCapsuleIntersectionInterval(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&)
TryGetCapsuleIntersectionInterval(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&)
TryGetCapsuleIntersectionInterval(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&,System.Boolean&,System.Boolean&)
TryGetUniqueIntersection(FixedMathSharp.Geometry.FixedSegment2d,FixedMathSharp.Fixed64&)
GetClosestPoints(FixedMathSharp.Geometry.FixedSegment2d)
TryGetUniqueIntersection(FixedMathSharp.Geometry.FixedSegment2d,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&)
Interpolate(FixedMathSharp.Geometry.FixedSegment2d,FixedMathSharp.Fixed64)
PointOnSegment(FixedMathSharp.Vector2d,FixedMathSharp.Geometry.FixedSegment2d)
ConsiderSharedEndpoint(FixedMathSharp.Vector2d,FixedMathSharp.Geometry.FixedSegment2d,FixedMathSharp.Geometry.FixedSegment2d,System.Int32&,FixedMathSharp.Vector2d&)
ConsiderClosestCandidate(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Vector2d&,FixedMathSharp.Vector2d&)
Deconstruct(FixedMathSharp.Vector2d&,FixedMathSharp.Vector2d&)
op_Equality(FixedMathSharp.Geometry.FixedSegment2d,FixedMathSharp.Geometry.FixedSegment2d)
op_Inequality(FixedMathSharp.Geometry.FixedSegment2d,FixedMathSharp.Geometry.FixedSegment2d)
Equals(FixedMathSharp.Geometry.FixedSegment2d)
Equals(System.Object)
GetHashCode()
TryGetCircleIntersectionDistanceInterval(FixedMathSharp.Geometry.FixedBoundCircle,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&)
TryGetCircleIntersectionDistanceInterval(FixedMathSharp.Geometry.FixedBoundCircle,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&,System.Boolean&,System.Boolean&)
TryGetCapsuleIntersectionDistanceInterval(FixedMathSharp.Geometry.FixedSegment2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&)
TryGetCapsuleIntersectionDistanceInterval(FixedMathSharp.Geometry.FixedSegment2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&,System.Boolean&,System.Boolean&)
TryGetCapsuleIntersectionDistanceInterval(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&)
TryGetCapsuleIntersectionDistanceInterval(FixedMathSharp.Vector2d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&,FixedMathSharp.Fixed64&,System.Boolean&,System.Boolean&)
GetPointAtDistance(FixedMathSharp.Fixed64,FixedMathSharp.Fixed64)
ValidateDistance(FixedMathSharp.Fixed64,FixedMathSharp.Fixed64)
ValidateTotalDistance(FixedMathSharp.Fixed64)