Table of Contents

Struct FixedBoundArea

Namespace
FixedMathSharp.Geometry
Assembly
FixedMathSharp.dll

Represents a normalized two-dimensional axis-aligned bounding area.

[MemoryPackable(GenerateType.Object)]
public struct FixedBoundArea : IEquatable<FixedBoundArea>, IMemoryPackable<FixedBoundArea>, IMemoryPackFormatterRegister
Implements
IMemoryPackable<FixedBoundArea>
IMemoryPackFormatterRegister
Inherited Members

Remarks

FixedMathSharp 2D geometry is plain Vector2d plane math. Use FromMinMax(Vector2d, Vector2d), FromCenterAndSize(Vector2d, Vector2d), or FromCenterAndScope(Vector2d, Vector2d) so construction intent is explicit.

Constructors

FixedBoundArea(BoundingAreaState)

Initializes a new instance from serialized or caller-provided state.

[JsonConstructor]
public FixedBoundArea(FixedBoundArea.BoundingAreaState state)

Parameters

state FixedBoundArea.BoundingAreaState

Properties

Center

The center of the area, rounded to the nearest-even Q32.32 lattice point.

[JsonIgnore]
[MemoryPackIgnore]
public Vector2d Center { get; set; }

Property Value

Vector2d

Remarks

Assigning a different center preserves a conservative half-extent. An odd raw-unit span can therefore expand by one raw unit so the assigned center remains exact and the previous area is not under-represented.

Exceptions

OverflowException

An assigned center would place an endpoint outside the scalar domain.

Max

The maximum corner of the area.

[JsonIgnore]
[MemoryPackIgnore]
public readonly Vector2d Max { get; }

Property Value

Vector2d

Min

The minimum corner of the area.

[JsonIgnore]
[MemoryPackIgnore]
public readonly Vector2d Min { get; }

Property Value

Vector2d

Scope

The smallest representable half-extent that conservatively contains the area around Center.

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

Property Value

Vector2d

Exceptions

OverflowException

A conservative half-extent is outside the representable scalar domain.

Size

The exact total width and height of the area.

[JsonIgnore]
[MemoryPackIgnore]
public Vector2d Size { get; set; }

Property Value

Vector2d

Remarks

Assigned values are normalized by absolute component value and divided outward. An odd raw-unit size therefore expands by one raw unit. Reading this property throws rather than returning a saturated value when an exact component span is not representable by Fixed64.

Exceptions

OverflowException

A component span is not representable, or an assigned size would place an endpoint outside the scalar domain.

State

Gets or sets the current normalized state of the area.

[JsonInclude]
[MemoryPackInclude]
public FixedBoundArea.BoundingAreaState State { get; }

Property Value

FixedBoundArea.BoundingAreaState

Methods

ClampPoint(Vector2d)

Clamps a point to the area boundary or interior.

public Vector2d ClampPoint(Vector2d point)

Parameters

point Vector2d

Returns

Vector2d

Contains(FixedBoundArea)

Classifies another area against this area using boundary-inclusive overlap.

public FixedEnclosureType Contains(FixedBoundArea area)

Parameters

area FixedBoundArea

Returns

FixedEnclosureType

Contains(FixedBoundCircle)

Classifies a circle against this area using boundary-inclusive overlap.

public FixedEnclosureType Contains(FixedBoundCircle circle)

Parameters

circle FixedBoundCircle

Returns

FixedEnclosureType

Contains(Vector2d)

Determines whether the point is inside this area, including the boundary.

public bool Contains(Vector2d point)

Parameters

point Vector2d

Returns

bool

Deconstruct(out Vector2d, out Vector2d)

Deconstructs the area into normalized minimum and maximum corners.

public void Deconstruct(out Vector2d min, out Vector2d max)

Parameters

min Vector2d
max Vector2d

Equals(FixedBoundArea)

public bool Equals(FixedBoundArea other)

Parameters

other FixedBoundArea

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

FromCenterAndOffsetsClippedToDomain(Vector2d, Vector2d, Vector2d)

Creates the representable-domain intersection of bounds described by a center and normalized center-relative minimum and maximum offsets.

public static FixedBoundArea FromCenterAndOffsetsClippedToDomain(Vector2d center, Vector2d minimumOffset, Vector2d maximumOffset)

Parameters

center Vector2d
minimumOffset Vector2d
maximumOffset Vector2d

Returns

FixedBoundArea

Remarks

Each endpoint is formed by one final saturating add, which is the explicit clipping operation. Asymmetric offsets are preserved.

Exceptions

ArgumentException

A minimum offset component exceeds the matching maximum component.

FromCenterAndScope(Vector2d, Vector2d)

Creates an area from a center point and half-size scope.

public static FixedBoundArea FromCenterAndScope(Vector2d center, Vector2d scope)

Parameters

center Vector2d
scope Vector2d

Returns

FixedBoundArea

Remarks

Negative scope components are normalized by absolute value.

Exceptions

OverflowException

A scope magnitude is not representable, or the centered area would place an endpoint outside the scalar domain.

FromCenterAndScopeClippedToDomain(Vector2d, Vector2d)

Creates the representable-domain intersection of an area described by a center point and half-size scope.

public static FixedBoundArea FromCenterAndScopeClippedToDomain(Vector2d center, Vector2d scope)

Parameters

center Vector2d
scope Vector2d

Returns

FixedBoundArea

Remarks

Negative scope components are normalized by absolute value. Endpoints outside the scalar domain are explicitly clipped to MinValue or MaxValue.

Exceptions

OverflowException

A scope magnitude is not representable.

FromCenterAndSize(Vector2d, Vector2d)

Creates an area from a center point and total size.

public static FixedBoundArea FromCenterAndSize(Vector2d center, Vector2d size)

Parameters

center Vector2d
size Vector2d

Returns

FixedBoundArea

Remarks

Negative size components are normalized by absolute value. Odd raw-unit sizes are divided outward and therefore expand by one raw unit.

Exceptions

OverflowException

The centered area would place an endpoint outside the scalar domain.

FromCenterAndSizeClippedToDomain(Vector2d, Vector2d)

Creates the representable-domain intersection of an area described by a center point and total size.

public static FixedBoundArea FromCenterAndSizeClippedToDomain(Vector2d center, Vector2d size)

Parameters

center Vector2d
size Vector2d

Returns

FixedBoundArea

Remarks

Negative size components are normalized by absolute value and odd raw- unit sizes divide outward. Endpoints outside the scalar domain are explicitly clipped to MinValue or MaxValue.

FromCenteredCapsuleClippedToDomain(Vector2d, Vector2d, Fixed64, Fixed64)

Creates the representable-domain intersection of a centered capsule's tight axis-aligned bounds from its full center-axis length.

public static FixedBoundArea FromCenteredCapsuleClippedToDomain(Vector2d center, Vector2d axisDirection, Fixed64 fullAxisLength, Fixed64 radius)

Parameters

center Vector2d

The center of the capsule's axis segment.

axisDirection Vector2d

The normalized center-axis direction.

fullAxisLength Fixed64

The nonnegative full center-axis length.

radius Fixed64

The nonnegative capsule radius.

Returns

FixedBoundArea

Remarks

Each exact endpoint is clipped to the scalar domain and rounded outward. Zero length and zero radius are valid degenerate capsules.

Exceptions

ArgumentException

axisDirection is zero or not normalized.

ArgumentOutOfRangeException

fullAxisLength or radius is negative.

FromCenteredRotatedCapsuleClippedToDomain(Vector2d, Fixed64, Fixed64, Fixed64)

Creates the representable-domain intersection of a centered capsule's tight axis-aligned bounds from its scalar frame rotation.

public static FixedBoundArea FromCenteredRotatedCapsuleClippedToDomain(Vector2d center, Fixed64 rotation, Fixed64 fullAxisLength, Fixed64 radius)

Parameters

center Vector2d
rotation Fixed64
fullAxisLength Fixed64
radius Fixed64

Returns

FixedBoundArea

Remarks

The capsule's local positive Y axis is its center axis. Sine and cosine remain authoritative through the exact finite-axis bound calculation; no rounded normalized world axis is fed back into the geometry.

Exceptions

ArgumentOutOfRangeException

fullAxisLength or radius is negative.

FromMinMax(Vector2d, Vector2d)

Creates a normalized area from minimum and maximum corners.

public static FixedBoundArea FromMinMax(Vector2d min, Vector2d max)

Parameters

min Vector2d
max Vector2d

Returns

FixedBoundArea

FromRotatedOffsetsClippedToDomain(Vector2d, Fixed64, ReadOnlySpan<Vector2d>)

Creates the representable-domain intersection of bounds around rotated local offsets without materializing any transformed point.

public static FixedBoundArea FromRotatedOffsetsClippedToDomain(Vector2d origin, Fixed64 rotation, ReadOnlySpan<Vector2d> localOffsets)

Parameters

origin Vector2d
rotation Fixed64
localOffsets ReadOnlySpan<Vector2d>

Returns

FixedBoundArea

GetHashCode()

public override int GetHashCode()

Returns

int

Intersects(FixedBoundArea)

Determines whether this area overlaps another area, including boundary-only contact.

public bool Intersects(FixedBoundArea area)

Parameters

area FixedBoundArea

Returns

bool

Intersects(FixedBoundCircle)

Determines whether this area overlaps a circle, including boundary-only contact.

public bool Intersects(FixedBoundCircle circle)

Parameters

circle FixedBoundCircle

Returns

bool

IntersectsStrict(FixedBoundArea)

Determines whether this area overlaps another area with positive area on both axes.

public bool IntersectsStrict(FixedBoundArea area)

Parameters

area FixedBoundArea

Returns

bool

IntersectsStrict(FixedBoundCircle)

Determines whether this area overlaps a circle with positive area.

public bool IntersectsStrict(FixedBoundCircle circle)

Parameters

circle FixedBoundCircle

Returns

bool

ProjectPoint(Vector2d)

Projects a point onto this area by clamping it to the boundary or interior.

public Vector2d ProjectPoint(Vector2d point)

Parameters

point Vector2d

Returns

Vector2d

SetMinMax(Vector2d, Vector2d)

Sets the normalized bounds of the area by specifying minimum and maximum points.

public void SetMinMax(Vector2d min, Vector2d max)

Parameters

min Vector2d
max Vector2d

Union(FixedBoundArea, FixedBoundArea)

Creates a new area that contains both input areas.

public static FixedBoundArea Union(FixedBoundArea a, FixedBoundArea b)

Parameters

a FixedBoundArea
b FixedBoundArea

Returns

FixedBoundArea

Operators

operator ==(FixedBoundArea, FixedBoundArea)

Determines whether two areas have the same normalized bounds.

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

Parameters

left FixedBoundArea
right FixedBoundArea

Returns

bool

operator !=(FixedBoundArea, FixedBoundArea)

Determines whether two areas have different normalized bounds.

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

Parameters

left FixedBoundArea
right FixedBoundArea

Returns

bool