Table of Contents

Struct ClusterSpatialQueryResult

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Result of a cluster spatial query match. Holds the matched EntityId, its location inside the cluster storage (chunk id and slot index), the entity's tight bounds as read by the narrowphase, and — for Radius queries — the squared distance from the query center to the closest point on the entity's AABB. For AABB queries, DistanceSq is 0 and should be ignored.

public readonly struct ClusterSpatialQueryResult
Inherited Members

Remarks

The bounds are f64 since #914, because they are WORLD coordinates and the world frame is f64. For an f32 tier the values are the stored floats widened — exact, so an AABB2F archetype reads back precisely what it stored — and for an f64 tier they are the only way the caller can see the coordinate the component actually holds. This is what "the query supports f64" has to mean beyond the query box: a result that narrowed the answer back to f32 would hand an AABB3D archetype at 10⁹ a bound quantised to ~128-unit steps, and the tier would be internal-only in the way #914 exists to stop. It also costs the narrowphase nothing: ReadAndValidateBoundsFromPtr already produced doubles, so the six per-entity conversions that used to narrow them are gone rather than added.

Fields

ClusterChunkId

Chunk id of the cluster holding the matched entity, within the archetype's cluster storage segment.

public readonly int ClusterChunkId

Field Value

int

DistanceSq

Squared distance from the query center to the closest point on the entity's AABB. Populated by Radius queries; always 0 for AABB queries. Used by ArchetypeClusterState.QueryNearest for top-k sorting. Issue #230 Phase 3.

public readonly double DistanceSq

Field Value

double

Entity

The matched entity, ready to Open, Destroy or store. Eight bytes, the same size as the packed id it replaced (#909).

public readonly EntityId Entity

Field Value

EntityId

MaxX

Maximum X of the entity's tight AABB.

public readonly double MaxX

Field Value

double

MaxY

Maximum Y of the entity's tight AABB.

public readonly double MaxY

Field Value

double

MaxZ

Maximum Z of the entity's tight AABB. For 2D archetypes this reflects the query's Z range (typically an infinity sentinel) and should be ignored.

public readonly double MaxZ

Field Value

double

MinX

Minimum X of the entity's tight AABB, as read by the narrowphase. Reading these bounds off the result lets callers skip a second component-table read.

public readonly double MinX

Field Value

double

MinY

Minimum Y of the entity's tight AABB.

public readonly double MinY

Field Value

double

MinZ

Minimum Z of the entity's tight AABB. For 2D archetypes this reflects the query's Z range (typically an infinity sentinel) and should be ignored.

public readonly double MinZ

Field Value

double

SlotIndex

Slot index of the matched entity within its cluster.

public readonly int SlotIndex

Field Value

int