Struct Vector3D
A three-component double-precision point, used for the spatial grid's world frame — its bounds, its cell size and the cell origins derived from them (#914).
public readonly struct Vector3D : IEquatable<Vector3D>
- Implements
- Inherited Members
Remarks
Why this type exists at all. The BCL has no f64 Vector3: Vector3 is f32 and Vector<double> is a
variable-width SIMD vector, not a 3-component point. The grid needs exactly three doubles with value semantics, so it declares them.
What it is NOT for. It does not appear in stored bounds. C15 keeps every stored bound — cluster AABBs, R-Tree node boxes, zone maps —
as f32 and cell-relative, and that is load-bearing rather than incidental: f64 node bounds would more than halve R-Tree fanout, attacking the
O(log C) the tree exists for. The floating-origin arrangement is what makes f32 storage deliver f64 world extent — a 24-bit mantissa spans a
1 000-unit cell at ~6 × 10⁻⁵ resolution independently of where that cell sits, so world extent is bounded by the cell INDEX range (21 bits per axis
of block key ≈ 2 × 10⁹ units) rather than by float precision. This type is the f64 half of that arrangement: the origins the f32 bounds are measured
from.
The implicit conversion from Vector3 is deliberate — widening f32 to f64 is exact and lossless, so every existing f32 call site keeps compiling and keeps meaning precisely what it meant. There is deliberately NO implicit conversion the other way: narrowing is lossy at the magnitudes this type exists to support, and a silent one would reintroduce the f32 world frame this replaces.
Constructors
Vector3D(double, double, double)
Construct from three components.
public Vector3D(double x, double y, double z)
Parameters
Vector3D(Vector2, double)
Construct from a 2D corner plus an explicit Z — the shape a flat world builds with.
public Vector3D(Vector2 xy, double z)
Parameters
Fields
X
The X component.
public readonly double X
Field Value
Y
The Y component.
public readonly double Y
Field Value
Z
The Z component.
public readonly double Z
Field Value
Methods
Equals(object)
public override bool Equals(object obj)
Parameters
objobject
Returns
Equals(Vector3D)
public bool Equals(Vector3D other)
Parameters
otherVector3D
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(Vector3D, Vector3D)
Component-wise equality.
public static bool operator ==(Vector3D left, Vector3D right)
Parameters
Returns
explicit operator Vector3(Vector3D)
Narrow to f32. Explicit, and lossy by construction — a world coordinate past ~1.7 × 10⁷ has more mantissa than f32 holds, which is the whole reason the world frame is f64. Use it only where the value is known to be small, such as a cell-relative offset.
public static explicit operator Vector3(Vector3D value)
Parameters
valueVector3D
Returns
implicit operator Vector3D(Vector3)
Widen an f32 point. Exact and lossless, which is why it is implicit.
public static implicit operator Vector3D(Vector3 value)
Parameters
valueVector3
Returns
operator !=(Vector3D, Vector3D)
Component-wise inequality.
public static bool operator !=(Vector3D left, Vector3D right)