Struct FixedSegment2d
- Namespace
- FixedMathSharp.Geometry
- Assembly
- FixedMathSharp.dll
Represents a finite line segment in two-dimensional fixed-point space.
[MemoryPackable(GenerateType.Object)]
public struct FixedSegment2d : IEquatable<FixedSegment2d>, IMemoryPackable<FixedSegment2d>, IMemoryPackFormatterRegister
- Implements
-
IMemoryPackable<FixedSegment2d>IMemoryPackFormatterRegister
- Inherited Members
Remarks
MemoryPack GenerateType: unmanaged
FixedMathSharp.Vector2d Start
FixedMathSharp.Vector2d End
Constructors
FixedSegment2d(Vector2d, Vector2d)
Initializes a new segment from start and end points.
[JsonConstructor]
public FixedSegment2d(Vector2d start, Vector2d end)
Parameters
Fields
End
The end point of the segment.
[JsonInclude]
[MemoryPackOrder(1)]
public Vector2d End
Field Value
Start
The start point of the segment.
[JsonInclude]
[MemoryPackOrder(0)]
public Vector2d Start
Field Value
Properties
Bounds
The normalized axis-aligned area that contains this segment.
[JsonIgnore]
[MemoryPackIgnore]
public FixedBoundArea Bounds { get; }
Property Value
Delta
[JsonIgnore]
[MemoryPackIgnore]
public Vector2d Delta { get; }
Property Value
Length
The segment length.
[JsonIgnore]
[MemoryPackIgnore]
public Fixed64 Length { get; }
Property Value
LengthSquared
The squared segment length.
[JsonIgnore]
[MemoryPackIgnore]
public Fixed64 LengthSquared { get; }
Property Value
Methods
ClosestPoint(Vector2d)
Finds the closest point on this finite segment to the supplied point.
public Vector2d ClosestPoint(Vector2d point)
Parameters
pointVector2d
Returns
Remarks
Zero-length segments deterministically return Start.
ContainsPointInCenteredCapsule(Vector2d, Vector2d, Fixed64, Fixed64, Fixed64)
Returns whether a point lies inside or on a centered rotated capsule.
public static bool ContainsPointInCenteredCapsule(Vector2d point, Vector2d center, Fixed64 frameRotation, Fixed64 axisLength, Fixed64 radius)
Parameters
Returns
ContainsPointInCenteredCapsule(Vector2d, Vector2d, Fixed64, Fixed64, Fixed64, Fixed64)
Returns whether a point lies inside or on a radially expanded centered rotated capsule.
public static bool ContainsPointInCenteredCapsule(Vector2d point, Vector2d center, Fixed64 frameRotation, Fixed64 axisLength, Fixed64 radius, Fixed64 radiusExpansion)
Parameters
pointVector2dcenterVector2dframeRotationFixed64axisLengthFixed64radiusFixed64radiusExpansionFixed64
Returns
ContainsPointInCenteredCapsule(Vector2d, Vector2d, Fixed64, Fixed64, Fixed64, Fixed64, bool)
Returns whether a point lies within a centered capsule whose local positive Y axis is transformed by a scalar rigid-frame rotation.
public static bool ContainsPointInCenteredCapsule(Vector2d point, Vector2d center, Fixed64 frameRotation, Fixed64 axisLength, Fixed64 radius, Fixed64 radiusExpansion, bool strict)
Parameters
pointVector2dcenterVector2dframeRotationFixed64axisLengthFixed64radiusFixed64radiusExpansionFixed64strictbool
Returns
ContainsPointInCenteredCapsule(Vector2d, Vector2d, Vector2d, Fixed64, Fixed64)
Returns whether a point lies inside or on a conceptual centered capsule.
public static bool ContainsPointInCenteredCapsule(Vector2d point, Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius)
Parameters
Returns
Exceptions
- ArgumentException
Thrown when
axisDirectionis zero or not normalized.- ArgumentOutOfRangeException
Thrown when
axisLengthorradiusis negative.
ContainsPointInCenteredCapsule(Vector2d, Vector2d, Vector2d, Fixed64, Fixed64, Fixed64)
Returns whether a point lies inside or on a conceptual centered capsule, including a nonnegative radial expansion.
public static bool ContainsPointInCenteredCapsule(Vector2d point, Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, Fixed64 radiusExpansion)
Parameters
pointVector2dcenterVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64radiusExpansionFixed64
Returns
Exceptions
- ArgumentException
Thrown when
axisDirectionis zero or not normalized.- ArgumentOutOfRangeException
Thrown when
axisLength,radius, orradiusExpansionis negative.
ContainsPointInCenteredCapsule(Vector2d, Vector2d, Vector2d, Fixed64, Fixed64, Fixed64, bool)
Returns whether a point lies strictly inside or inclusively within a conceptual centered capsule with nonnegative radial expansion.
public static bool ContainsPointInCenteredCapsule(Vector2d point, Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, Fixed64 radiusExpansion, bool strict)
Parameters
pointVector2dcenterVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64radiusExpansionFixed64strictbool
Returns
ContainsPointInCenteredCapsule(Vector2d, Vector2d, Vector2d, Fixed64, Fixed64, bool)
Returns whether a point lies strictly inside or inclusively within a conceptual centered capsule.
public static bool ContainsPointInCenteredCapsule(Vector2d point, Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, bool strict)
Parameters
Returns
Deconstruct(out Vector2d, out Vector2d)
Deconstructs the segment into start and end points.
public void Deconstruct(out Vector2d start, out Vector2d end)
Parameters
DistanceSquared(Vector2d)
Computes the squared distance from the supplied point to this finite segment.
public Fixed64 DistanceSquared(Vector2d point)
Parameters
pointVector2d
Returns
DoCenteredCapsulesOverlap(Vector2d, Fixed64, Fixed64, Fixed64, Vector2d, Fixed64, Fixed64, Fixed64)
Returns whether two centered capsules expressed by scalar rigid-frame rotations overlap, including exact tangency.
public static bool DoCenteredCapsulesOverlap(Vector2d firstCenter, Fixed64 firstRotation, Fixed64 firstAxisLength, Fixed64 firstRadius, Vector2d secondCenter, Fixed64 secondRotation, Fixed64 secondAxisLength, Fixed64 secondRadius)
Parameters
firstCenterVector2dfirstRotationFixed64firstAxisLengthFixed64firstRadiusFixed64secondCenterVector2dsecondRotationFixed64secondAxisLengthFixed64secondRadiusFixed64
Returns
DoCenteredCapsulesOverlap(Vector2d, Vector2d, Fixed64, Fixed64, Vector2d, Vector2d, Fixed64, Fixed64)
Returns whether two conceptual centered capsules overlap, including exact tangency, without narrowing their axis distance or radius sum.
public static bool DoCenteredCapsulesOverlap(Vector2d firstCenter, Vector2d firstAxisDirection, Fixed64 firstAxisLength, Fixed64 firstRadius, Vector2d secondCenter, Vector2d secondAxisDirection, Fixed64 secondAxisLength, Fixed64 secondRadius)
Parameters
firstCenterVector2dfirstAxisDirectionVector2dfirstAxisLengthFixed64firstRadiusFixed64secondCenterVector2dsecondAxisDirectionVector2dsecondAxisLengthFixed64secondRadiusFixed64
Returns
Equals(FixedSegment2d)
public bool Equals(FixedSegment2d other)
Parameters
otherFixedSegment2d
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetCenteredCapsuleSupportAnchor(Vector2d, Fixed64, Vector2d, Fixed64, Fixed64, Vector2d)
Returns the support anchor of a conceptual centered capsule without combining its axial and radial feature components.
public static FixedPointAnchor2d GetCenteredCapsuleSupportAnchor(Vector2d center, Fixed64 frameRotation, Vector2d localAxisDirection, Fixed64 axisLength, Fixed64 radius, Vector2d localDirection)
Parameters
centerVector2dframeRotationFixed64localAxisDirectionVector2daxisLengthFixed64radiusFixed64localDirectionVector2d
Returns
Remarks
The direction need not be normalized. A zero direction and an exact axial tie select the axis center.
GetClosestPoints(FixedSegment2d)
Returns the closest finite points on this segment and another segment.
public readonly (Vector2d ThisPoint, Vector2d OtherPoint) GetClosestPoints(FixedSegment2d other)
Parameters
otherFixedSegment2d
Returns
Remarks
Exact shared endpoints are returned in this-start, this-end, other-start, other-end order before parameterized interior intersections. Remaining endpoint projections use the same order, and exact distance ties keep the first candidate.
GetDirectionFromCenteredAxis(Vector2d, Vector2d, Fixed64, Fixed64)
Returns the normalized direction from the closest point on a centered capsule axis expressed by a scalar rigid-frame rotation.
public static Vector2d GetDirectionFromCenteredAxis(Vector2d point, Vector2d center, Fixed64 frameRotation, Fixed64 axisLength)
Parameters
Returns
GetDirectionFromCenteredAxis(Vector2d, Vector2d, Vector2d, Fixed64)
Returns the normalized direction from the closest point on a conceptual
centered finite axis toward point, or zero when the
point lies on that axis.
public static Vector2d GetDirectionFromCenteredAxis(Vector2d point, Vector2d center, Vector2d axisDirection, Fixed64 axisLength)
Parameters
Returns
Remarks
The conceptual endpoints are
center +/- axisDirection * (axisLength / 2). They are never
constructed or narrowed before the closest-feature decision.
Exceptions
- ArgumentException
Thrown when
axisDirectionis zero or not normalized.- ArgumentOutOfRangeException
Thrown when
axisLengthis negative.
GetDistanceToCenteredCapsule(Vector2d, Vector2d, Fixed64, Fixed64, Fixed64)
Returns the rounded distance from a point to a centered rotated capsule.
public static Fixed64 GetDistanceToCenteredCapsule(Vector2d point, Vector2d center, Fixed64 frameRotation, Fixed64 axisLength, Fixed64 radius)
Parameters
Returns
GetDistanceToCenteredCapsule(Vector2d, Vector2d, Vector2d, Fixed64, Fixed64)
Returns the rounded nonnegative distance from a point to a conceptual centered capsule surface, saturating to MaxValue when the distance is not representable.
public static Fixed64 GetDistanceToCenteredCapsule(Vector2d point, Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius)
Parameters
Returns
Remarks
The final value uses round-half-to-even. Points inside or on the capsule return zero.
Exceptions
- ArgumentException
Thrown when
axisDirectionis zero or not normalized.- ArgumentOutOfRangeException
Thrown when
axisLengthorradiusis negative.
GetHashCode()
public override int GetHashCode()
Returns
GetPointAtDistance(Fixed64, Fixed64)
Reconstructs the point at an authored physical distance along this segment using one exact chord interpolation per coordinate.
public readonly Vector2d GetPointAtDistance(Fixed64 distance, Fixed64 totalDistance)
Parameters
Returns
Remarks
This method does not normalize Delta. It therefore retains representable chord components that would round away in a normalized direction. The final coordinates use round-half-to-even.
Exceptions
- ArgumentOutOfRangeException
Thrown when
totalDistanceis negative, or whendistanceis outside [0,totalDistance].- ArgumentException
Thrown when
totalDistanceis zero and this segment is not a point.
GetSurfaceAnchorOnCenteredCapsule(Vector2d, Vector2d, Fixed64, Vector2d, Fixed64, Fixed64, Vector2d)
Returns the centered-capsule surface anchor nearest to a world-space point in the supplied normalized surface direction.
public static FixedPointAnchor2d GetSurfaceAnchorOnCenteredCapsule(Vector2d point, Vector2d center, Fixed64 frameRotation, Vector2d localAxisDirection, Fixed64 axisLength, Fixed64 radius, Vector2d localSurfaceDirection)
Parameters
pointVector2dcenterVector2dframeRotationFixed64localAxisDirectionVector2daxisLengthFixed64radiusFixed64localSurfaceDirectionVector2d
Returns
TryGetCapsuleIntersectionDistanceInterval(FixedSegment2d, Fixed64, Fixed64, Fixed64, out Fixed64, out Fixed64, out bool, out bool)
Finds the physical-distance interval where this segment intersects an endpoint-authored, radially expanded capsule and reports exact endpoint containment.
public readonly bool TryGetCapsuleIntersectionDistanceInterval(FixedSegment2d capsuleAxis, Fixed64 radius, Fixed64 radiusExpansion, Fixed64 totalDistance, out Fixed64 entryDistance, out Fixed64 exitDistance, out bool startContained, out bool endContainedStrict)
Parameters
capsuleAxisFixedSegment2dradiusFixed64radiusExpansionFixed64totalDistanceFixed64entryDistanceFixed64exitDistanceFixed64startContainedboolendContainedStrictbool
Returns
TryGetCapsuleIntersectionDistanceInterval(FixedSegment2d, Fixed64, Fixed64, out Fixed64, out Fixed64)
Finds the physical-distance interval where this segment intersects an endpoint-authored capsule.
public readonly bool TryGetCapsuleIntersectionDistanceInterval(FixedSegment2d capsuleAxis, Fixed64 radius, Fixed64 totalDistance, out Fixed64 entryDistance, out Fixed64 exitDistance)
Parameters
capsuleAxisFixedSegment2dradiusFixed64totalDistanceFixed64entryDistanceFixed64exitDistanceFixed64
Returns
TryGetCapsuleIntersectionDistanceInterval(Vector2d, Fixed64, Fixed64, Fixed64, Fixed64, Fixed64, out Fixed64, out Fixed64, out bool, out bool)
Finds the physical-distance interval where this segment intersects a centered rotated capsule.
public readonly bool TryGetCapsuleIntersectionDistanceInterval(Vector2d center, Fixed64 rotation, Fixed64 axisLength, Fixed64 radius, Fixed64 radiusExpansion, Fixed64 totalDistance, out Fixed64 entryDistance, out Fixed64 exitDistance, out bool startContained, out bool endContainedStrict)
Parameters
centerVector2drotationFixed64axisLengthFixed64radiusFixed64radiusExpansionFixed64totalDistanceFixed64entryDistanceFixed64exitDistanceFixed64startContainedboolendContainedStrictbool
Returns
TryGetCapsuleIntersectionDistanceInterval(Vector2d, Vector2d, Fixed64, Fixed64, Fixed64, Fixed64, out Fixed64, out Fixed64, out bool, out bool)
Finds the physical-distance interval where this segment intersects a centered, radially expanded capsule and reports exact endpoint containment.
public readonly bool TryGetCapsuleIntersectionDistanceInterval(Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, Fixed64 radiusExpansion, Fixed64 totalDistance, out Fixed64 entryDistance, out Fixed64 exitDistance, out bool startContained, out bool endContainedStrict)
Parameters
centerVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64radiusExpansionFixed64totalDistanceFixed64entryDistanceFixed64exitDistanceFixed64startContainedboolendContainedStrictbool
Returns
TryGetCapsuleIntersectionDistanceInterval(Vector2d, Vector2d, Fixed64, Fixed64, Fixed64, out Fixed64, out Fixed64)
Finds the physical-distance interval where this segment intersects a centered capsule.
public readonly bool TryGetCapsuleIntersectionDistanceInterval(Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, Fixed64 totalDistance, out Fixed64 entryDistance, out Fixed64 exitDistance)
Parameters
centerVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64totalDistanceFixed64entryDistanceFixed64exitDistanceFixed64
Returns
TryGetCapsuleIntersectionInterval(FixedSegment2d, Fixed64, Fixed64, out Fixed64, out Fixed64)
Finds the closed parameter interval where this segment intersects a radially expanded capsule.
public readonly bool TryGetCapsuleIntersectionInterval(FixedSegment2d capsuleAxis, Fixed64 radius, Fixed64 radiusExpansion, out Fixed64 entryParameter, out Fixed64 exitParameter)
Parameters
capsuleAxisFixedSegment2dradiusFixed64radiusExpansionFixed64entryParameterFixed64exitParameterFixed64
Returns
Remarks
The authored radius and sweep expansion remain separate until the exact finite-axis solve. Returned parameters are clamped to [0, 1]. A zero-length capsule axis is treated as a circle.
Exceptions
- ArgumentOutOfRangeException
Thrown when
radiusorradiusExpansionis negative.
TryGetCapsuleIntersectionInterval(FixedSegment2d, Fixed64, Fixed64, out Fixed64, out Fixed64, out bool, out bool)
Finds the closed parameter interval where this segment intersects a capsule and reports exact endpoint containment.
public readonly bool TryGetCapsuleIntersectionInterval(FixedSegment2d capsuleAxis, Fixed64 radius, Fixed64 radiusExpansion, out Fixed64 entryParameter, out Fixed64 exitParameter, out bool startContained, out bool endContainedStrict)
Parameters
capsuleAxisFixedSegment2dradiusFixed64radiusExpansionFixed64entryParameterFixed64exitParameterFixed64startContainedboolendContainedStrictbool
Returns
Remarks
startContained is inclusive of the capsule boundary.
endContainedStrict is true only for the mathematical
interior. Both classifications use the wide solve inputs rather than rounded
parameters or reconstructed points. A zero-length capsule axis is treated as
a circle.
Exceptions
- ArgumentOutOfRangeException
Thrown when
radiusorradiusExpansionis negative.
TryGetCapsuleIntersectionInterval(FixedSegment2d, Fixed64, out Fixed64, out Fixed64)
Finds the closed parameter interval where this segment intersects a capsule.
public readonly bool TryGetCapsuleIntersectionInterval(FixedSegment2d capsuleAxis, Fixed64 radius, out Fixed64 entryParameter, out Fixed64 exitParameter)
Parameters
capsuleAxisFixedSegment2dradiusFixed64entryParameterFixed64exitParameterFixed64
Returns
Remarks
The capsule is described by its finite center-line segment and radius. Returned parameters are clamped to [0, 1]. A zero-length capsule axis is treated as a circle.
Exceptions
- ArgumentOutOfRangeException
Thrown when
radiusis negative.
TryGetCapsuleIntersectionInterval(Vector2d, Vector2d, Fixed64, Fixed64, Fixed64, out Fixed64, out Fixed64)
Finds the closed parameter interval where this segment intersects a centered, radially expanded capsule.
public readonly bool TryGetCapsuleIntersectionInterval(Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, Fixed64 radiusExpansion, out Fixed64 entryParameter, out Fixed64 exitParameter)
Parameters
centerVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64radiusExpansionFixed64entryParameterFixed64exitParameterFixed64
Returns
Exceptions
- ArgumentException
Thrown when
axisDirectionis zero or not normalized.- ArgumentOutOfRangeException
Thrown when
axisLength,radiusorradiusExpansionis negative.
TryGetCapsuleIntersectionInterval(Vector2d, Vector2d, Fixed64, Fixed64, Fixed64, out Fixed64, out Fixed64, out bool, out bool)
Finds the closed parameter interval where this segment intersects a centered, radially expanded capsule and reports exact endpoint containment.
public readonly bool TryGetCapsuleIntersectionInterval(Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, Fixed64 radiusExpansion, out Fixed64 entryParameter, out Fixed64 exitParameter, out bool startContained, out bool endContainedStrict)
Parameters
centerVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64radiusExpansionFixed64entryParameterFixed64exitParameterFixed64startContainedboolendContainedStrictbool
Returns
Remarks
The normalized axis defines the conceptual center-line endpoints as
center +/- axisDirection * (axisLength / 2) without constructing or
narrowing either endpoint. startContained includes the
boundary; endContainedStrict excludes it.
Exceptions
- ArgumentException
Thrown when
axisDirectionis zero or not normalized.- ArgumentOutOfRangeException
Thrown when
axisLength,radiusorradiusExpansionis negative.
TryGetCapsuleIntersectionInterval(Vector2d, Vector2d, Fixed64, Fixed64, out Fixed64, out Fixed64)
Finds the closed parameter interval where this segment intersects a centered capsule.
public readonly bool TryGetCapsuleIntersectionInterval(Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, out Fixed64 entryParameter, out Fixed64 exitParameter)
Parameters
centerVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64entryParameterFixed64exitParameterFixed64
Returns
Exceptions
- ArgumentException
Thrown when
axisDirectionis zero or not normalized.- ArgumentOutOfRangeException
Thrown when
axisLengthorradiusis negative.
TryGetCenteredAxisEndpoint(Vector2d, Vector2d, Fixed64, bool, out Vector2d)
Attempts to materialize one endpoint of a conceptual centered finite axis from its normalized direction and full length.
public static bool TryGetCenteredAxisEndpoint(Vector2d center, Vector2d axisDirection, Fixed64 axisLength, bool positive, out Vector2d endpoint)
Parameters
Returns
Remarks
The endpoint is rounded only after combining its center and half-length contribution. Failure is atomic.
TryGetCenteredCapsuleConvexContacts(Vector2d, Fixed64, Vector2d, Fixed64, Fixed64, Vector2d, Fixed64, ReadOnlySpan<Vector2d>, Span<FixedPointAnchor2d>, Span<FixedPointAnchor2d>, out int, out Vector2d, out Fixed64, out bool)
Attempts to build contact anchors between a conceptual centered capsule and a rotated closed convex polygon.
public static bool TryGetCenteredCapsuleConvexContacts(Vector2d capsuleCenter, Fixed64 capsuleRotation, Vector2d localCapsuleAxisDirection, Fixed64 capsuleAxisLength, Fixed64 capsuleRadius, Vector2d convexOrigin, Fixed64 convexRotation, ReadOnlySpan<Vector2d> convexVertexOffsets, Span<FixedPointAnchor2d> capsuleContacts, Span<FixedPointAnchor2d> convexContacts, out int contactCount, out Vector2d normal, out Fixed64 depth, out bool depthIsClamped)
Parameters
capsuleCenterVector2dcapsuleRotationFixed64localCapsuleAxisDirectionVector2dcapsuleAxisLengthFixed64capsuleRadiusFixed64convexOriginVector2dconvexRotationFixed64convexVertexOffsetsReadOnlySpan<Vector2d>capsuleContactsSpan<FixedPointAnchor2d>convexContactsSpan<FixedPointAnchor2d>contactCountintnormalVector2ddepthFixed64depthIsClampedbool
Returns
Remarks
localCapsuleAxisDirection is expressed in the
capsule frame. Returned capsule anchors retain their axial and radial
feature terms separately.
TryGetCenteredCapsuleConvexMinimumTranslation(Vector2d, Fixed64, Fixed64, Fixed64, Vector2d, ReadOnlySpan<Vector2d>, out Vector2d, out Fixed64)
Finds the minimum translation that separates a centered rotated capsule from a closed convex polygon represented by origin-relative offsets.
public static bool TryGetCenteredCapsuleConvexMinimumTranslation(Vector2d center, Fixed64 rotation, Fixed64 axisLength, Fixed64 radius, Vector2d convexOrigin, ReadOnlySpan<Vector2d> convexVertexOffsets, out Vector2d normal, out Fixed64 depth)
Parameters
centerVector2drotationFixed64axisLengthFixed64radiusFixed64convexOriginVector2dconvexVertexOffsetsReadOnlySpan<Vector2d>normalVector2ddepthFixed64
Returns
TryGetCenteredCapsuleConvexMinimumTranslation(Vector2d, Vector2d, Fixed64, Fixed64, Vector2d, Fixed64, ReadOnlySpan<Vector2d>, out Vector2d, out Fixed64)
Finds the minimum translation that separates a conceptual centered capsule from a rotated closed convex polygon.
public static bool TryGetCenteredCapsuleConvexMinimumTranslation(Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, Vector2d convexOrigin, Fixed64 convexRotation, ReadOnlySpan<Vector2d> convexVertexOffsets, out Vector2d normal, out Fixed64 depth)
Parameters
centerVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64convexOriginVector2dconvexRotationFixed64convexVertexOffsetsReadOnlySpan<Vector2d>normalVector2ddepthFixed64
Returns
TryGetCenteredCapsuleConvexMinimumTranslation(Vector2d, Vector2d, Fixed64, Fixed64, Vector2d, ReadOnlySpan<Vector2d>, out Vector2d, out Fixed64)
Finds the minimum translation that separates a conceptual centered capsule from a closed convex polygon represented by an origin and origin-relative vertex offsets.
public static bool TryGetCenteredCapsuleConvexMinimumTranslation(Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, Vector2d convexOrigin, ReadOnlySpan<Vector2d> convexVertexOffsets, out Vector2d normal, out Fixed64 depth)
Parameters
centerVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64convexOriginVector2dconvexVertexOffsetsReadOnlySpan<Vector2d>normalVector2ddepthFixed64
Returns
Remarks
Offsets must be supplied in boundary order. Exact depth ties retain the first authored edge axis, and exact direction ties retain the first authored vertex. Neither shape's conceptual world vertices need to be representable.
TryGetCenteredCapsuleSupport(Vector2d, Fixed64, Fixed64, Fixed64, Vector2d, out Vector2d)
Attempts to materialize support for a centered rotated capsule.
public static bool TryGetCenteredCapsuleSupport(Vector2d center, Fixed64 frameRotation, Fixed64 axisLength, Fixed64 radius, Vector2d direction, out Vector2d support)
Parameters
centerVector2dframeRotationFixed64axisLengthFixed64radiusFixed64directionVector2dsupportVector2d
Returns
TryGetCenteredCapsuleSupport(Vector2d, Vector2d, Fixed64, Fixed64, Vector2d, out Vector2d)
Attempts to materialize the support point of a conceptual centered capsule in a world-space direction.
public static bool TryGetCenteredCapsuleSupport(Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, Vector2d direction, out Vector2d support)
Parameters
centerVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64directionVector2dsupportVector2d
Returns
Remarks
The direction need not be normalized. A zero direction and an exact axial tie select the capsule center along the tied axis.
TryGetCenteredCapsulesContact(Vector2d, Fixed64, Fixed64, Fixed64, Vector2d, Fixed64, Fixed64, Fixed64, Vector2d, out FixedContactAnchors2d)
Attempts to build exact anchors between two centered capsules expressed by scalar rigid-frame rotations.
public static bool TryGetCenteredCapsulesContact(Vector2d firstCenter, Fixed64 firstRotation, Fixed64 firstAxisLength, Fixed64 firstRadius, Vector2d secondCenter, Fixed64 secondRotation, Fixed64 secondAxisLength, Fixed64 secondRadius, Vector2d fallbackNormal, out FixedContactAnchors2d contact)
Parameters
firstCenterVector2dfirstRotationFixed64firstAxisLengthFixed64firstRadiusFixed64secondCenterVector2dsecondRotationFixed64secondAxisLengthFixed64secondRadiusFixed64fallbackNormalVector2dcontactFixedContactAnchors2d
Returns
TryGetCenteredCapsulesContact(Vector2d, Fixed64, Vector2d, Fixed64, Fixed64, Vector2d, Fixed64, Vector2d, Fixed64, Fixed64, Vector2d, out FixedContactAnchors2d)
Attempts to build an exact contact between two conceptual centered capsules.
public static bool TryGetCenteredCapsulesContact(Vector2d firstCenter, Fixed64 firstAnchorRotation, Vector2d firstAxisDirection, Fixed64 firstAxisLength, Fixed64 firstRadius, Vector2d secondCenter, Fixed64 secondAnchorRotation, Vector2d secondAxisDirection, Fixed64 secondAxisLength, Fixed64 secondRadius, Vector2d fallbackNormal, out FixedContactAnchors2d contact)
Parameters
firstCenterVector2dfirstAnchorRotationFixed64firstAxisDirectionVector2dfirstAxisLengthFixed64firstRadiusFixed64secondCenterVector2dsecondAnchorRotationFixed64secondAxisDirectionVector2dsecondAxisLengthFixed64secondRadiusFixed64fallbackNormalVector2dcontactFixedContactAnchors2d
Returns
Remarks
Each surface witness retains its axial and radial contributions separately. Classification is independent of absolute world-point materialization.
TryGetCircleIntersectionDistanceInterval(FixedBoundCircle, Fixed64, Fixed64, out Fixed64, out Fixed64, out bool, out bool)
Finds the physical-distance interval where this segment intersects a radially expanded circle and reports exact endpoint containment.
public readonly bool TryGetCircleIntersectionDistanceInterval(FixedBoundCircle circle, Fixed64 radiusExpansion, Fixed64 totalDistance, out Fixed64 entryDistance, out Fixed64 exitDistance, out bool startContained, out bool endContainedStrict)
Parameters
circleFixedBoundCircleradiusExpansionFixed64totalDistanceFixed64entryDistanceFixed64exitDistanceFixed64startContainedboolendContainedStrictbool
Returns
Remarks
The exact segment interval maps to [0, totalDistance] with one
final round-half-to-even conversion. Start containment is inclusive;
end containment is strict and is classified before distance rounding.
TryGetCircleIntersectionDistanceInterval(FixedBoundCircle, Fixed64, out Fixed64, out Fixed64)
Finds the physical-distance interval where this segment intersects a circle, mapped to the caller-supplied total distance.
public readonly bool TryGetCircleIntersectionDistanceInterval(FixedBoundCircle circle, Fixed64 totalDistance, out Fixed64 entryDistance, out Fixed64 exitDistance)
Parameters
circleFixedBoundCircletotalDistanceFixed64entryDistanceFixed64exitDistanceFixed64
Returns
TryGetClosestPointsBetweenCenteredAxes(Vector2d, Vector2d, Fixed64, Vector2d, Vector2d, Fixed64, out Vector2d, out Vector2d)
Attempts to return the closest points on two conceptual centered finite axes described by normalized directions and full lengths.
public static bool TryGetClosestPointsBetweenCenteredAxes(Vector2d firstCenter, Vector2d firstAxisDirection, Fixed64 firstAxisLength, Vector2d secondCenter, Vector2d secondAxisDirection, Fixed64 secondAxisLength, out Vector2d firstPoint, out Vector2d secondPoint)
Parameters
firstCenterVector2dfirstAxisDirectionVector2dfirstAxisLengthFixed64secondCenterVector2dsecondAxisDirectionVector2dsecondAxisLengthFixed64firstPointVector2dsecondPointVector2d
Returns
- bool
true when both final world points are representable; otherwise false and both outputs are zero.
TryGetDistanceBetweenCenteredAxes(Vector2d, Vector2d, Fixed64, Vector2d, Vector2d, Fixed64, out Fixed64)
Attempts to return the rounded distance between two conceptual centered finite axes without materializing either pair of endpoints.
public static bool TryGetDistanceBetweenCenteredAxes(Vector2d firstCenter, Vector2d firstAxisDirection, Fixed64 firstAxisLength, Vector2d secondCenter, Vector2d secondAxisDirection, Fixed64 secondAxisLength, out Fixed64 distance)
Parameters
firstCenterVector2dfirstAxisDirectionVector2dfirstAxisLengthFixed64secondCenterVector2dsecondAxisDirectionVector2dsecondAxisLengthFixed64distanceFixed64
Returns
TryGetDistanceToCenteredAxis(Vector2d, Vector2d, Vector2d, Fixed64, out Fixed64)
Attempts to return the rounded distance from a point to a conceptual centered finite axis without materializing its endpoints.
public static bool TryGetDistanceToCenteredAxis(Vector2d point, Vector2d center, Vector2d axisDirection, Fixed64 axisLength, out Fixed64 distance)
Parameters
Returns
TryGetDistanceToCenteredCapsule(Vector2d, Vector2d, Fixed64, Fixed64, Fixed64, out Fixed64)
Attempts to return the rounded distance from a point to a centered rotated capsule.
public static bool TryGetDistanceToCenteredCapsule(Vector2d point, Vector2d center, Fixed64 frameRotation, Fixed64 axisLength, Fixed64 radius, out Fixed64 distance)
Parameters
pointVector2dcenterVector2dframeRotationFixed64axisLengthFixed64radiusFixed64distanceFixed64
Returns
TryGetDistanceToCenteredCapsule(Vector2d, Vector2d, Vector2d, Fixed64, Fixed64, out Fixed64)
Attempts to return the rounded nonnegative distance from a point to a conceptual centered capsule surface.
public static bool TryGetDistanceToCenteredCapsule(Vector2d point, Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, out Fixed64 distance)
Parameters
pointVector2dcenterVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64distanceFixed64
Returns
- bool
True when the final distance is representable; otherwise false and
distanceis MaxValue. Points inside or on the capsule return zero.
Remarks
The final value uses round-half-to-even.
Exceptions
- ArgumentException
Thrown when
axisDirectionis zero or not normalized.- ArgumentOutOfRangeException
Thrown when
axisLengthorradiusis negative.
TryGetSurfaceOffsetOnCenteredCapsule(Vector2d, Vector2d, Fixed64, Fixed64, Fixed64, Vector2d, out Vector2d)
Attempts to materialize the center-relative selected surface offset of a centered rotated capsule.
public static bool TryGetSurfaceOffsetOnCenteredCapsule(Vector2d point, Vector2d center, Fixed64 frameRotation, Fixed64 axisLength, Fixed64 radius, Vector2d surfaceDirection, out Vector2d surfaceOffset)
Parameters
pointVector2dcenterVector2dframeRotationFixed64axisLengthFixed64radiusFixed64surfaceDirectionVector2dsurfaceOffsetVector2d
Returns
TryGetSurfaceOffsetOnCenteredCapsule(Vector2d, Vector2d, Vector2d, Fixed64, Fixed64, Vector2d, out Vector2d)
Attempts to return the center-relative surface offset on a conceptual centered capsule nearest to a world-space point in the supplied surface direction.
public static bool TryGetSurfaceOffsetOnCenteredCapsule(Vector2d point, Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, Vector2d surfaceDirection, out Vector2d surfaceOffset)
Parameters
pointVector2dcenterVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64surfaceDirectionVector2dsurfaceOffsetVector2d
Returns
TryGetSurfacePointOnCenteredCapsule(Vector2d, Vector2d, Fixed64, Fixed64, Fixed64, Vector2d, out Vector2d)
Attempts to materialize the selected surface point of a centered rotated capsule.
public static bool TryGetSurfacePointOnCenteredCapsule(Vector2d point, Vector2d center, Fixed64 frameRotation, Fixed64 axisLength, Fixed64 radius, Vector2d surfaceDirection, out Vector2d surfacePoint)
Parameters
pointVector2dcenterVector2dframeRotationFixed64axisLengthFixed64radiusFixed64surfaceDirectionVector2dsurfacePointVector2d
Returns
TryGetSurfacePointOnCenteredCapsule(Vector2d, Vector2d, Vector2d, Fixed64, Fixed64, Vector2d, out Vector2d)
Attempts to return the selected point on a conceptual centered capsule surface without narrowing its axis point before applying the radial offset.
public static bool TryGetSurfacePointOnCenteredCapsule(Vector2d point, Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, Vector2d surfaceDirection, out Vector2d surfacePoint)
Parameters
pointVector2dcenterVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64surfaceDirectionVector2dsurfacePointVector2d
Returns
- bool
True when every final surface coordinate is representable; otherwise false and
surfacePointis zero.
Remarks
surfaceDirection must be the nonzero result of
GetDirectionFromCenteredAxis(Vector2d, Vector2d, Vector2d, Fixed64),
or a caller-selected normalized
direction perpendicular to the axis when that method returns zero.
Exceptions
- ArgumentException
Thrown when
axisDirectionis zero or not normalized, or whensurfaceDirectionis not normalized.- ArgumentOutOfRangeException
Thrown when
axisLengthorradiusis negative.
TryGetSweptCenteredCapsuleSegmentFirstDistance(Vector2d, Fixed64, Fixed64, Fixed64, Vector2d, Fixed64, FixedSegment2d, Fixed64, out Fixed64, out Vector2d)
Finds the first distance where a translated centered rotated capsule intersects an endpoint-authored capsule axis.
public static bool TryGetSweptCenteredCapsuleSegmentFirstDistance(Vector2d center, Fixed64 rotation, Fixed64 axisLength, Fixed64 radius, Vector2d direction, Fixed64 maximumDistance, FixedSegment2d targetAxis, Fixed64 targetRadius, out Fixed64 distance, out Vector2d normal)
Parameters
centerVector2drotationFixed64axisLengthFixed64radiusFixed64directionVector2dmaximumDistanceFixed64targetAxisFixedSegment2dtargetRadiusFixed64distanceFixed64normalVector2d
Returns
TryGetSweptCenteredCapsuleSegmentFirstDistance(Vector2d, Vector2d, Fixed64, Fixed64, Vector2d, Fixed64, FixedSegment2d, Fixed64, out Fixed64, out Vector2d)
Finds the first distance where a translated conceptual centered capsule intersects an endpoint-authored capsule axis.
public static bool TryGetSweptCenteredCapsuleSegmentFirstDistance(Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, Vector2d direction, Fixed64 maximumDistance, FixedSegment2d targetAxis, Fixed64 targetRadius, out Fixed64 distance, out Vector2d normal)
Parameters
centerVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64directionVector2dmaximumDistanceFixed64targetAxisFixedSegment2dtargetRadiusFixed64distanceFixed64normalVector2d
Returns
TryGetSweptCenteredCapsulesFirstDistance(Vector2d, Fixed64, Fixed64, Fixed64, Vector2d, Fixed64, Vector2d, Fixed64, Fixed64, Fixed64, out Fixed64, out Vector2d)
Finds the first distance where a translated centered rotated capsule intersects another centered rotated capsule.
public static bool TryGetSweptCenteredCapsulesFirstDistance(Vector2d center, Fixed64 rotation, Fixed64 axisLength, Fixed64 radius, Vector2d direction, Fixed64 maximumDistance, Vector2d targetCenter, Fixed64 targetRotation, Fixed64 targetAxisLength, Fixed64 targetRadius, out Fixed64 distance, out Vector2d normal)
Parameters
centerVector2drotationFixed64axisLengthFixed64radiusFixed64directionVector2dmaximumDistanceFixed64targetCenterVector2dtargetRotationFixed64targetAxisLengthFixed64targetRadiusFixed64distanceFixed64normalVector2d
Returns
TryGetSweptCenteredCapsulesFirstDistance(Vector2d, Vector2d, Fixed64, Fixed64, Vector2d, Fixed64, Vector2d, Vector2d, Fixed64, Fixed64, out Fixed64, out Vector2d)
Finds the first distance where a translated conceptual centered capsule intersects another conceptual centered capsule.
public static bool TryGetSweptCenteredCapsulesFirstDistance(Vector2d center, Vector2d axisDirection, Fixed64 axisLength, Fixed64 radius, Vector2d direction, Fixed64 maximumDistance, Vector2d targetCenter, Vector2d targetAxisDirection, Fixed64 targetAxisLength, Fixed64 targetRadius, out Fixed64 distance, out Vector2d normal)
Parameters
centerVector2daxisDirectionVector2daxisLengthFixed64radiusFixed64directionVector2dmaximumDistanceFixed64targetCenterVector2dtargetAxisDirectionVector2dtargetAxisLengthFixed64targetRadiusFixed64distanceFixed64normalVector2d
Returns
TryGetUniqueIntersection(FixedSegment2d, out Fixed64)
Attempts to find the unique intersection point shared by this segment and another segment.
public readonly bool TryGetUniqueIntersection(FixedSegment2d other, out Fixed64 thisParameter)
Parameters
otherFixedSegment2dthisParameterFixed64
Returns
Remarks
Closed endpoint touches and coincident point segments have one unique intersection. Collinear segments with a positive-length overlap do not.
Operators
operator ==(FixedSegment2d, FixedSegment2d)
Determines whether two segments have the same ordered endpoints.
public static bool operator ==(FixedSegment2d left, FixedSegment2d right)
Parameters
leftFixedSegment2drightFixedSegment2d
Returns
operator !=(FixedSegment2d, FixedSegment2d)
Determines whether two segments have different ordered endpoints.
public static bool operator !=(FixedSegment2d left, FixedSegment2d right)
Parameters
leftFixedSegment2drightFixedSegment2d