Struct FixedPointAnchor2d
- Namespace
- FixedMathSharp.Geometry
- Assembly
- FixedMathSharp.dll
Identifies a conceptual 2D point by an origin, scalar rotation, and local point without requiring the transformed point to be representable.
public readonly struct FixedPointAnchor2d : IEquatable<FixedPointAnchor2d>
- Implements
- Inherited Members
Remarks
Relation-produced anchors can retain an exact sub-lattice feature term that is intentionally hidden behind the narrow comparison and materialization APIs. Anchors with identical rounded public local components can therefore remain distinct when they identify different exact features.
Constructors
FixedPointAnchor2d(Vector2d, Fixed64, Vector2d)
Creates a transformed point anchor.
public FixedPointAnchor2d(Vector2d origin, Fixed64 rotation, Vector2d localPoint)
Parameters
FixedPointAnchor2d(Vector2d, Fixed64, Vector2d, Vector2d)
Creates a transformed point anchor from two additive local-space feature components.
public FixedPointAnchor2d(Vector2d origin, Fixed64 rotation, Vector2d localPoint, Vector2d localDisplacement)
Parameters
Properties
LocalDisplacement
An additional local-space feature displacement that exact operations add to LocalPoint without a scalar intermediate.
public Vector2d LocalDisplacement { get; }
Property Value
LocalPoint
Gets the point in its supplied local frame.
public Vector2d LocalPoint { get; }
Property Value
Origin
Gets the point frame's world-space origin.
public Vector2d Origin { get; }
Property Value
Rotation
Gets the point frame's counterclockwise rotation in radians.
public Fixed64 Rotation { get; }
Property Value
Methods
CompareLocalFeature(in FixedPointAnchor2d)
Compares the complete local feature identity of this anchor with
other in deterministic component order.
public int CompareLocalFeature(in FixedPointAnchor2d other)
Parameters
otherFixedPointAnchor2d
Returns
Remarks
Frame origin and rotation are intentionally excluded. Exact sub-lattice centered-axis residuals are included after the public local components.
CompareSquaredDistance(in FixedPointAnchor2d, in FixedPointAnchor2d)
Compares the exact squared distance from this point to two other anchored points.
public int CompareSquaredDistance(in FixedPointAnchor2d first, in FixedPointAnchor2d second)
Parameters
firstFixedPointAnchor2dsecondFixedPointAnchor2d
Returns
- int
A negative value when
firstis closer, zero when the distances are equal, or a positive value whensecondis closer.
Equals(FixedPointAnchor2d)
Returns whether both anchors have identical frames, rounded local components, and any retained exact feature identity.
public bool Equals(FixedPointAnchor2d other)
Parameters
otherFixedPointAnchor2d
Returns
Equals(object?)
Returns a hash code for the complete frame and exact feature identity.
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
GetLocalFeatureHash64()
Returns a stable 64-bit hash of the complete local feature identity.
public ulong GetLocalFeatureHash64()
Returns
TryGetLocalPointIn(Vector2d, Fixed64, out Vector2d)
Attempts to express this conceptual point in another rotated frame without materializing the world-space point.
public bool TryGetLocalPointIn(Vector2d frameOrigin, Fixed64 frameRotation, out Vector2d localPoint)
Parameters
Returns
TryGetOffsetFrom(in FixedPointAnchor2d, out Vector2d)
Attempts to obtain this point's exact offset from another transformed point without materializing either world-space point.
public bool TryGetOffsetFrom(in FixedPointAnchor2d other, out Vector2d offset)
Parameters
otherFixedPointAnchor2doffsetVector2d
Returns
TryGetPoint(out Vector2d)
Attempts to materialize the conceptual world-space point with one final round-half-to-even conversion per component.
public bool TryGetPoint(out Vector2d point)
Parameters
pointVector2d
Returns
TryReframe(Vector2d, Fixed64, out FixedPointAnchor2d)
Attempts to express this exact conceptual point in another rotated frame without discarding sub-lattice feature information.
public bool TryReframe(Vector2d frameOrigin, Fixed64 frameRotation, out FixedPointAnchor2d anchor)
Parameters
frameOriginVector2dframeRotationFixed64anchorFixedPointAnchor2d
Returns
Remarks
The operation fails when the target frame would require a general rational local coordinate that a compact point anchor cannot retain.
Operators
operator ==(FixedPointAnchor2d, FixedPointAnchor2d)
Returns whether two anchors have identical frame and local-point components.
public static bool operator ==(FixedPointAnchor2d left, FixedPointAnchor2d right)
Parameters
leftFixedPointAnchor2drightFixedPointAnchor2d
Returns
operator !=(FixedPointAnchor2d, FixedPointAnchor2d)
Returns whether two anchors differ in any frame or local-point component.
public static bool operator !=(FixedPointAnchor2d left, FixedPointAnchor2d right)
Parameters
leftFixedPointAnchor2drightFixedPointAnchor2d