Table of Contents

Struct FixedPointAnchor

Namespace
FixedMathSharp.Geometry
Assembly
FixedMathSharp.dll

Represents a 3D point as a local coordinate in one rigid world-space frame.

public readonly struct FixedPointAnchor : IEquatable<FixedPointAnchor>
Implements
Inherited Members

Remarks

Keeping the frame components separate allows full-domain geometry to retain points whose rotated offset or absolute world coordinate is not representable as an intermediate Fixed64 value. Relation-produced anchors can also retain an exact sub-lattice feature term that is intentionally not exposed as a public wide-arithmetic primitive. Consequently, anchors with identical rounded public local components can still compare unequal when they identify distinct exact features.

Constructors

FixedPointAnchor(Vector3d, FixedQuaternion, Vector3d)

Initializes a point anchor from a world origin, normalized local-to-world rotation, and local point.

public FixedPointAnchor(Vector3d origin, FixedQuaternion rotation, Vector3d localPoint)

Parameters

origin Vector3d
rotation FixedQuaternion
localPoint Vector3d

Exceptions

ArgumentException

rotation is not normalized.

FixedPointAnchor(Vector3d, FixedQuaternion, Vector3d, Vector3d)

Initializes a point anchor from a world origin, normalized local-to-world rotation, and two additive local-space feature components.

public FixedPointAnchor(Vector3d origin, FixedQuaternion rotation, Vector3d localPoint, Vector3d localDisplacement)

Parameters

origin Vector3d
rotation FixedQuaternion
localPoint Vector3d
localDisplacement Vector3d

Exceptions

ArgumentException

rotation is not normalized.

Properties

LocalDisplacement

An additional local-space feature displacement that exact operations add to LocalPoint without a scalar intermediate.

public Vector3d LocalDisplacement { get; }

Property Value

Vector3d

LocalPoint

The point in the rigid frame's local coordinates.

public Vector3d LocalPoint { get; }

Property Value

Vector3d

LocalTranslation

An independent local-space translation applied to the complete anchored point without merging it into either feature component.

public Vector3d LocalTranslation { get; }

Property Value

Vector3d

Origin

The world-space origin of the rigid frame.

public Vector3d Origin { get; }

Property Value

Vector3d

Rotation

The normalized local-to-world rotation of the rigid frame.

public FixedQuaternion Rotation { get; }

Property Value

FixedQuaternion

Methods

CompareLocalFeature(in FixedPointAnchor)

Compares the complete local feature identity of this anchor with other in deterministic component order.

public int CompareLocalFeature(in FixedPointAnchor other)

Parameters

other FixedPointAnchor

Returns

int

Remarks

Frame origin, rotation, and LocalTranslation are intentionally excluded because they move a feature without changing its local identity. Exact sub-lattice centered-axis residuals are included after the public feature components, so distinct features cannot collapse when their rounded local coordinates are equal.

CompareSquaredDistance(in FixedPointAnchor, in FixedPointAnchor)

Compares the exact squared distance from this point to two other anchored points.

public int CompareSquaredDistance(in FixedPointAnchor first, in FixedPointAnchor second)

Parameters

first FixedPointAnchor
second FixedPointAnchor

Returns

int

A negative value when first is closer, zero when the distances are equal, or a positive value when second is closer.

Equals(FixedPointAnchor)

Returns whether both anchors have identical frames, rounded local components, and any retained exact feature identity.

public bool Equals(FixedPointAnchor other)

Parameters

other FixedPointAnchor

Returns

bool

Equals(object?)

Returns a hash code for the complete frame and exact feature identity.

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

GetLocalFeatureHash64()

Returns a stable 64-bit hash of the complete local feature identity.

public ulong GetLocalFeatureHash64()

Returns

ulong

ProjectNonNegativeOffsetFrom(in FixedPointAnchor, Vector3d)

Projects this point minus other onto direction and returns zero for nonpositive results, the positive projection floored to Q32.32, or MaxValue when only the final result is unrepresentable.

public Fixed64 ProjectNonNegativeOffsetFrom(in FixedPointAnchor other, Vector3d direction)

Parameters

other FixedPointAnchor
direction Vector3d

Returns

Fixed64

Exceptions

InvalidOperationException

This anchor does not contain a normalized rotation.

ArgumentException

other does not contain a normalized rotation.

TryGetLocalPointIn(Vector3d, FixedQuaternion, out Vector3d)

Attempts to express this point in another rigid frame's local coordinates without first materializing its absolute world position.

public bool TryGetLocalPointIn(Vector3d frameOrigin, FixedQuaternion frameRotation, out Vector3d localPoint)

Parameters

frameOrigin Vector3d
frameRotation FixedQuaternion
localPoint Vector3d

Returns

bool

TryGetOffsetFrom(in FixedPointAnchor, out Vector3d)

Attempts to materialize this point's world-space offset from other.

public bool TryGetOffsetFrom(in FixedPointAnchor other, out Vector3d offset)

Parameters

other FixedPointAnchor
offset Vector3d

Returns

bool

TryGetPoint(out Vector3d)

Attempts to materialize the absolute world point.

public bool TryGetPoint(out Vector3d point)

Parameters

point Vector3d

Returns

bool

TryGetProjectedOffsetFrom(in FixedPointAnchor, Vector3d, out Fixed64)

Attempts to project this point minus other onto direction with one final round-half-to-even conversion.

public bool TryGetProjectedOffsetFrom(in FixedPointAnchor other, Vector3d direction, out Fixed64 projection)

Parameters

other FixedPointAnchor
direction Vector3d
projection Fixed64

Returns

bool

TryGetScaledOffsetFrom(in FixedPointAnchor, Fixed64, out Vector3d)

Attempts to materialize this point's world-space offset from other after applying scale.

public bool TryGetScaledOffsetFrom(in FixedPointAnchor other, Fixed64 scale, out Vector3d offset)

Parameters

other FixedPointAnchor
scale Fixed64
offset Vector3d

Returns

bool

Remarks

The scale is applied to the complete conceptual difference before its final round-half-to-even conversion.

TryReframe(Vector3d, FixedQuaternion, out FixedPointAnchor)

Attempts to express this exact conceptual point in another rigid frame without discarding any sub-lattice feature information.

public bool TryReframe(Vector3d frameOrigin, FixedQuaternion frameRotation, out FixedPointAnchor anchor)

Parameters

frameOrigin Vector3d
frameRotation FixedQuaternion
anchor FixedPointAnchor

Returns

bool

Remarks

The operation fails when the target frame would require a general rational local coordinate that a compact point anchor cannot retain.

WithLocalTranslation(Vector3d)

Returns an anchor for the same exact local feature with the specified independent local-space translation.

public FixedPointAnchor WithLocalTranslation(Vector3d localTranslation)

Parameters

localTranslation Vector3d

Returns

FixedPointAnchor

Operators

operator ==(FixedPointAnchor, FixedPointAnchor)

Returns whether two point anchors have identical frame components.

public static bool operator ==(FixedPointAnchor left, FixedPointAnchor right)

Parameters

left FixedPointAnchor
right FixedPointAnchor

Returns

bool

operator !=(FixedPointAnchor, FixedPointAnchor)

Returns whether two point anchors have different frame components.

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

Parameters

left FixedPointAnchor
right FixedPointAnchor

Returns

bool