Table of Contents

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

start Vector2d
end Vector2d

Fields

End

The end point of the segment.

[JsonInclude]
[MemoryPackOrder(1)]
public Vector2d End

Field Value

Vector2d

Start

The start point of the segment.

[JsonInclude]
[MemoryPackOrder(0)]
public Vector2d Start

Field Value

Vector2d

Properties

Bounds

The normalized axis-aligned area that contains this segment.

[JsonIgnore]
[MemoryPackIgnore]
public FixedBoundArea Bounds { get; }

Property Value

FixedBoundArea

Delta

The vector from Start to End.

[JsonIgnore]
[MemoryPackIgnore]
public Vector2d Delta { get; }

Property Value

Vector2d

Length

The segment length.

[JsonIgnore]
[MemoryPackIgnore]
public Fixed64 Length { get; }

Property Value

Fixed64

LengthSquared

The squared segment length.

[JsonIgnore]
[MemoryPackIgnore]
public Fixed64 LengthSquared { get; }

Property Value

Fixed64

Methods

ClosestPoint(Vector2d)

Finds the closest point on this finite segment to the supplied point.

public Vector2d ClosestPoint(Vector2d point)

Parameters

point Vector2d

Returns

Vector2d

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

point Vector2d
center Vector2d
frameRotation Fixed64
axisLength Fixed64
radius Fixed64

Returns

bool

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

point Vector2d
center Vector2d
frameRotation Fixed64
axisLength Fixed64
radius Fixed64
radiusExpansion Fixed64

Returns

bool

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

point Vector2d
center Vector2d
frameRotation Fixed64
axisLength Fixed64
radius Fixed64
radiusExpansion Fixed64
strict bool

Returns

bool

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

point Vector2d
center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64

Returns

bool

Exceptions

ArgumentException

Thrown when axisDirection is zero or not normalized.

ArgumentOutOfRangeException

Thrown when axisLength or radius is 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

point Vector2d
center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
radiusExpansion Fixed64

Returns

bool

Exceptions

ArgumentException

Thrown when axisDirection is zero or not normalized.

ArgumentOutOfRangeException

Thrown when axisLength, radius, or radiusExpansion is 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

point Vector2d
center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
radiusExpansion Fixed64
strict bool

Returns

bool

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

point Vector2d
center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
strict bool

Returns

bool

Deconstruct(out Vector2d, out Vector2d)

Deconstructs the segment into start and end points.

public void Deconstruct(out Vector2d start, out Vector2d end)

Parameters

start Vector2d
end Vector2d

DistanceSquared(Vector2d)

Computes the squared distance from the supplied point to this finite segment.

public Fixed64 DistanceSquared(Vector2d point)

Parameters

point Vector2d

Returns

Fixed64

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

firstCenter Vector2d
firstRotation Fixed64
firstAxisLength Fixed64
firstRadius Fixed64
secondCenter Vector2d
secondRotation Fixed64
secondAxisLength Fixed64
secondRadius Fixed64

Returns

bool

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

firstCenter Vector2d
firstAxisDirection Vector2d
firstAxisLength Fixed64
firstRadius Fixed64
secondCenter Vector2d
secondAxisDirection Vector2d
secondAxisLength Fixed64
secondRadius Fixed64

Returns

bool

Equals(FixedSegment2d)

public bool Equals(FixedSegment2d other)

Parameters

other FixedSegment2d

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

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

center Vector2d
frameRotation Fixed64
localAxisDirection Vector2d
axisLength Fixed64
radius Fixed64
localDirection Vector2d

Returns

FixedPointAnchor2d

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

other FixedSegment2d

Returns

(Vector2d ThisPoint, Vector2d OtherPoint)

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

point Vector2d
center Vector2d
frameRotation Fixed64
axisLength Fixed64

Returns

Vector2d

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

point Vector2d
center Vector2d
axisDirection Vector2d
axisLength Fixed64

Returns

Vector2d

Remarks

The conceptual endpoints are center +/- axisDirection * (axisLength / 2). They are never constructed or narrowed before the closest-feature decision.

Exceptions

ArgumentException

Thrown when axisDirection is zero or not normalized.

ArgumentOutOfRangeException

Thrown when axisLength is 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

point Vector2d
center Vector2d
frameRotation Fixed64
axisLength Fixed64
radius Fixed64

Returns

Fixed64

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

point Vector2d
center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64

Returns

Fixed64

Remarks

The final value uses round-half-to-even. Points inside or on the capsule return zero.

Exceptions

ArgumentException

Thrown when axisDirection is zero or not normalized.

ArgumentOutOfRangeException

Thrown when axisLength or radius is negative.

GetHashCode()

public override int GetHashCode()

Returns

int

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

distance Fixed64
totalDistance Fixed64

Returns

Vector2d

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 totalDistance is negative, or when distance is outside [0, totalDistance].

ArgumentException

Thrown when totalDistance is 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

point Vector2d
center Vector2d
frameRotation Fixed64
localAxisDirection Vector2d
axisLength Fixed64
radius Fixed64
localSurfaceDirection Vector2d

Returns

FixedPointAnchor2d

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

capsuleAxis FixedSegment2d
radius Fixed64
radiusExpansion Fixed64
totalDistance Fixed64
entryDistance Fixed64
exitDistance Fixed64
startContained bool
endContainedStrict bool

Returns

bool

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

capsuleAxis FixedSegment2d
radius Fixed64
totalDistance Fixed64
entryDistance Fixed64
exitDistance Fixed64

Returns

bool

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

center Vector2d
rotation Fixed64
axisLength Fixed64
radius Fixed64
radiusExpansion Fixed64
totalDistance Fixed64
entryDistance Fixed64
exitDistance Fixed64
startContained bool
endContainedStrict bool

Returns

bool

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

center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
radiusExpansion Fixed64
totalDistance Fixed64
entryDistance Fixed64
exitDistance Fixed64
startContained bool
endContainedStrict bool

Returns

bool

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

center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
totalDistance Fixed64
entryDistance Fixed64
exitDistance Fixed64

Returns

bool

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

capsuleAxis FixedSegment2d
radius Fixed64
radiusExpansion Fixed64
entryParameter Fixed64
exitParameter Fixed64

Returns

bool

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 radius or radiusExpansion is 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

capsuleAxis FixedSegment2d
radius Fixed64
radiusExpansion Fixed64
entryParameter Fixed64
exitParameter Fixed64
startContained bool
endContainedStrict bool

Returns

bool

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 radius or radiusExpansion is 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

capsuleAxis FixedSegment2d
radius Fixed64
entryParameter Fixed64
exitParameter Fixed64

Returns

bool

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 radius is 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

center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
radiusExpansion Fixed64
entryParameter Fixed64
exitParameter Fixed64

Returns

bool

Exceptions

ArgumentException

Thrown when axisDirection is zero or not normalized.

ArgumentOutOfRangeException

Thrown when axisLength, radius or radiusExpansion is 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

center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
radiusExpansion Fixed64
entryParameter Fixed64
exitParameter Fixed64
startContained bool
endContainedStrict bool

Returns

bool

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 axisDirection is zero or not normalized.

ArgumentOutOfRangeException

Thrown when axisLength, radius or radiusExpansion is 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

center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
entryParameter Fixed64
exitParameter Fixed64

Returns

bool

Exceptions

ArgumentException

Thrown when axisDirection is zero or not normalized.

ArgumentOutOfRangeException

Thrown when axisLength or radius is 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

center Vector2d
axisDirection Vector2d
axisLength Fixed64
positive bool
endpoint Vector2d

Returns

bool

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

capsuleCenter Vector2d
capsuleRotation Fixed64
localCapsuleAxisDirection Vector2d
capsuleAxisLength Fixed64
capsuleRadius Fixed64
convexOrigin Vector2d
convexRotation Fixed64
convexVertexOffsets ReadOnlySpan<Vector2d>
capsuleContacts Span<FixedPointAnchor2d>
convexContacts Span<FixedPointAnchor2d>
contactCount int
normal Vector2d
depth Fixed64
depthIsClamped bool

Returns

bool

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

center Vector2d
rotation Fixed64
axisLength Fixed64
radius Fixed64
convexOrigin Vector2d
convexVertexOffsets ReadOnlySpan<Vector2d>
normal Vector2d
depth Fixed64

Returns

bool

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

center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
convexOrigin Vector2d
convexRotation Fixed64
convexVertexOffsets ReadOnlySpan<Vector2d>
normal Vector2d
depth Fixed64

Returns

bool

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

center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
convexOrigin Vector2d
convexVertexOffsets ReadOnlySpan<Vector2d>
normal Vector2d
depth Fixed64

Returns

bool

true when the shapes overlap, including tangency; otherwise false and both outputs are zero.

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

center Vector2d
frameRotation Fixed64
axisLength Fixed64
radius Fixed64
direction Vector2d
support Vector2d

Returns

bool

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

center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
direction Vector2d
support Vector2d

Returns

bool

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

firstCenter Vector2d
firstRotation Fixed64
firstAxisLength Fixed64
firstRadius Fixed64
secondCenter Vector2d
secondRotation Fixed64
secondAxisLength Fixed64
secondRadius Fixed64
fallbackNormal Vector2d
contact FixedContactAnchors2d

Returns

bool

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

firstCenter Vector2d
firstAnchorRotation Fixed64
firstAxisDirection Vector2d
firstAxisLength Fixed64
firstRadius Fixed64
secondCenter Vector2d
secondAnchorRotation Fixed64
secondAxisDirection Vector2d
secondAxisLength Fixed64
secondRadius Fixed64
fallbackNormal Vector2d
contact FixedContactAnchors2d

Returns

bool

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

circle FixedBoundCircle
radiusExpansion Fixed64
totalDistance Fixed64
entryDistance Fixed64
exitDistance Fixed64
startContained bool
endContainedStrict bool

Returns

bool

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

circle FixedBoundCircle
totalDistance Fixed64
entryDistance Fixed64
exitDistance Fixed64

Returns

bool

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

firstCenter Vector2d
firstAxisDirection Vector2d
firstAxisLength Fixed64
secondCenter Vector2d
secondAxisDirection Vector2d
secondAxisLength Fixed64
firstPoint Vector2d
secondPoint Vector2d

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

firstCenter Vector2d
firstAxisDirection Vector2d
firstAxisLength Fixed64
secondCenter Vector2d
secondAxisDirection Vector2d
secondAxisLength Fixed64
distance Fixed64

Returns

bool

True when the final distance is representable; otherwise false and distance is MaxValue.

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

point Vector2d
center Vector2d
axisDirection Vector2d
axisLength Fixed64
distance Fixed64

Returns

bool

True when the final distance is representable; otherwise false and distance is MaxValue.

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

point Vector2d
center Vector2d
frameRotation Fixed64
axisLength Fixed64
radius Fixed64
distance Fixed64

Returns

bool

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

point Vector2d
center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
distance Fixed64

Returns

bool

True when the final distance is representable; otherwise false and distance is MaxValue. Points inside or on the capsule return zero.

Remarks

The final value uses round-half-to-even.

Exceptions

ArgumentException

Thrown when axisDirection is zero or not normalized.

ArgumentOutOfRangeException

Thrown when axisLength or radius is 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

point Vector2d
center Vector2d
frameRotation Fixed64
axisLength Fixed64
radius Fixed64
surfaceDirection Vector2d
surfaceOffset Vector2d

Returns

bool

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

point Vector2d
center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
surfaceDirection Vector2d
surfaceOffset Vector2d

Returns

bool

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

point Vector2d
center Vector2d
frameRotation Fixed64
axisLength Fixed64
radius Fixed64
surfaceDirection Vector2d
surfacePoint Vector2d

Returns

bool

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

point Vector2d
center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
surfaceDirection Vector2d
surfacePoint Vector2d

Returns

bool

True when every final surface coordinate is representable; otherwise false and surfacePoint is 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 axisDirection is zero or not normalized, or when surfaceDirection is not normalized.

ArgumentOutOfRangeException

Thrown when axisLength or radius is 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

center Vector2d
rotation Fixed64
axisLength Fixed64
radius Fixed64
direction Vector2d
maximumDistance Fixed64
targetAxis FixedSegment2d
targetRadius Fixed64
distance Fixed64
normal Vector2d

Returns

bool

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

center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
direction Vector2d
maximumDistance Fixed64
targetAxis FixedSegment2d
targetRadius Fixed64
distance Fixed64
normal Vector2d

Returns

bool

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

center Vector2d
rotation Fixed64
axisLength Fixed64
radius Fixed64
direction Vector2d
maximumDistance Fixed64
targetCenter Vector2d
targetRotation Fixed64
targetAxisLength Fixed64
targetRadius Fixed64
distance Fixed64
normal Vector2d

Returns

bool

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

center Vector2d
axisDirection Vector2d
axisLength Fixed64
radius Fixed64
direction Vector2d
maximumDistance Fixed64
targetCenter Vector2d
targetAxisDirection Vector2d
targetAxisLength Fixed64
targetRadius Fixed64
distance Fixed64
normal Vector2d

Returns

bool

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

other FixedSegment2d
thisParameter Fixed64

Returns

bool

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

left FixedSegment2d
right FixedSegment2d

Returns

bool

operator !=(FixedSegment2d, FixedSegment2d)

Determines whether two segments have different ordered endpoints.

public static bool operator !=(FixedSegment2d left, FixedSegment2d right)

Parameters

left FixedSegment2d
right FixedSegment2d

Returns

bool