Class GridCellGeometry
Builds exact topology-owned cell prisms and contact manifolds without floating-point conversion.
public static class GridCellGeometry
- Inheritance
-
GridCellGeometry
- Inherited Members
Methods
GetContact(in GridCellPrism, in GridCellPrism)
Computes the exact closed-set contact between two cell prisms.
public static VoxelContactManifold GetContact(in GridCellPrism source, in GridCellPrism target)
Parameters
sourceGridCellPrismtargetGridCellPrism
Returns
GetExactBoundaryContactsInto(VoxelGrid, VoxelGrid, SwiftList<VoxelContactManifold>, GridContactQueryScratch)
Builds exact contacts between physical voxels in a candidate grid pair into caller-owned output.
public static int GetExactBoundaryContactsInto(VoxelGrid sourceGrid, VoxelGrid targetGrid, SwiftList<VoxelContactManifold> results, GridContactQueryScratch scratch)
Parameters
sourceGridVoxelGridtargetGridVoxelGridresultsSwiftList<VoxelContactManifold>scratchGridContactQueryScratch
Returns
- int
The number of manifolds written to
results.
Remarks
Source and target cells are processed in canonical local-index order. The supplied scratch retains broad-phase capacity so warmed calls allocate no managed memory. Separated AABB candidates are omitted.
IsNavigationBodyAnchorValid(in GridCellPrism, Vector3d, Fixed64, Fixed64, in GridNavigationPortal)
Determines whether one cylindrical body anchor fits an exact cell prism, optionally through one selected navigation portal.
public static bool IsNavigationBodyAnchorValid(in GridCellPrism prism, Vector3d foot, Fixed64 horizontalRadius, Fixed64 bodyHeight, in GridNavigationPortal selectedPortal)
Parameters
prismGridCellPrismfootVector3dhorizontalRadiusFixed64bodyHeightFixed64selectedPortalGridNavigationPortal
Returns
Remarks
This is the degenerate-segment form of IsNavigationBodySegmentValid(in GridCellPrism, Vector3d, Vector3d, Fixed64, Fixed64, in GridNavigationPortal, in GridNavigationPortal, GridNavigationBodySegmentEndpointAllowance). The shared swept-body authority therefore owns all wall, opening, height, and equality behavior.
IsNavigationBodySegmentValid(in GridCellPrism, Vector3d, Vector3d, Fixed64, Fixed64, in GridNavigationPortal, in GridNavigationPortal, GridNavigationBodySegmentEndpointAllowance)
Determines whether a cylindrical body can sweep one straight foot segment through an exact cell prism, optionally approaching an incoming and outgoing vertical portal.
public static bool IsNavigationBodySegmentValid(in GridCellPrism prism, Vector3d footStart, Vector3d footEnd, Fixed64 horizontalRadius, Fixed64 bodyHeight, in GridNavigationPortal incomingPortal, in GridNavigationPortal outgoingPortal, GridNavigationBodySegmentEndpointAllowance endpointAllowance)
Parameters
prismGridCellPrismfootStartVector3dfootEndVector3dhorizontalRadiusFixed64bodyHeightFixed64incomingPortalGridNavigationPortaloutgoingPortalGridNavigationPortalendpointAllowanceGridNavigationBodySegmentEndpointAllowance
Returns
Remarks
The horizontal capsule is compared exactly with every blocked wall span. Selected portal openings retain their own vertical authority and apply only while the sweep overlaps that opening. Each selected portal must cover its complete possible overlap; a segment that would need to switch height authority between two same-wall openings is rejected. A non-default endpoint allowance clips one exact directed footprint-edge crossing inside GridForge before validating the retained in-prism segment. The method retains no state and allocates nothing.
TryCreateNavigationPortal(in GridCellPrism, in GridCellPrism, out GridNavigationPortal)
Attempts to compile one exact, directed navigation portal from two cell prisms.
public static bool TryCreateNavigationPortal(in GridCellPrism source, in GridCellPrism target, out GridNavigationPortal portal)
Parameters
sourceGridCellPrismtargetGridCellPrismportalGridNavigationPortal
Returns
Remarks
Contact discovery and convex clipping occur only during compilation. The resulting value contains no live grid references and resolves body profiles in constant time.
TryCreatePrism(GridTopologyKind, GridTopologyMetrics, Vector3d, WorldVoxelIndex, out GridCellPrism)
Attempts to build an exact prism from normalized topology metrics and a world-space cell center.
public static bool TryCreatePrism(GridTopologyKind topologyKind, GridTopologyMetrics topologyMetrics, Vector3d center, WorldVoxelIndex cell, out GridCellPrism prism)
Parameters
topologyKindGridTopologyKindtopologyMetricsGridTopologyMetricscenterVector3dcellWorldVoxelIndexprismGridCellPrism
Returns
Remarks
This overload permits offline geometry construction. The supplied identity is copied verbatim.
TryGetNavigationPortalTraversalParameters(in GridCellPrism, in GridCellPrism, in GridNavigationPortal, Vector3d, Vector3d, Fixed64, Fixed64, out Fixed64, out Fixed64)
Attempts to certify where one straight body-foot segment traverses an exact directed portal.
public static bool TryGetNavigationPortalTraversalParameters(in GridCellPrism sourcePrism, in GridCellPrism targetPrism, in GridNavigationPortal portal, Vector3d footStart, Vector3d footEnd, Fixed64 horizontalRadius, Fixed64 bodyHeight, out Fixed64 sourceParameter, out Fixed64 targetParameter)
Parameters
sourcePrismGridCellPrismtargetPrismGridCellPrismportalGridNavigationPortalfootStartVector3dfootEndVector3dhorizontalRadiusFixed64bodyHeightFixed64sourceParameterFixed64targetParameterFixed64
Returns
Remarks
Vertical portals return a directed source/target enclosure around the exact crossing. Horizontal portals return the ordered parameters of the exact profile anchors. Both forms certify the body against the authored source/target prism pair.
TryGetPrimaryFace(VoxelGrid, VoxelIndex, VoxelIndex, out VoxelContactManifold)
Attempts to get exact face geometry for a safe same-grid primary adjacency.
public static bool TryGetPrimaryFace(VoxelGrid grid, VoxelIndex sourceIndex, VoxelIndex targetIndex, out VoxelContactManifold manifold)
Parameters
gridVoxelGridsourceIndexVoxelIndextargetIndexVoxelIndexmanifoldVoxelContactManifold
Returns
Remarks
Rectangular diagonals and hex vertical-diagonal offsets are deliberately rejected.
TryGetPrism(VoxelGrid, VoxelIndex, out GridCellPrism)
Attempts to build the exact prism for one physical voxel in an active grid.
public static bool TryGetPrism(VoxelGrid grid, VoxelIndex index, out GridCellPrism prism)
Parameters
gridVoxelGridindexVoxelIndexprismGridCellPrism
Returns
TryValidateNavigationCorridor(ReadOnlySpan<GridCellPrism>, Vector3d, Vector3d, Fixed64, Fixed64, Span<Vector3d>, out int, out Fixed64)
Validates a canonical, clearance-bearing corridor through an ordered chain of exact cell prisms.
public static bool TryValidateNavigationCorridor(ReadOnlySpan<GridCellPrism> orderedCells, Vector3d entryAnchor, Vector3d exitAnchor, Fixed64 radiusClearance, Fixed64 heightClearance, Span<Vector3d> portalWaypoints, out int portalWaypointCount, out Fixed64 geometricCost)
Parameters
orderedCellsReadOnlySpan<GridCellPrism>Source cell, zero or more witness cells, and destination cell.
entryAnchorVector3dFoot position inside the source cell.
exitAnchorVector3dFoot position inside the destination cell.
radiusClearanceFixed64Required horizontal body radius.
heightClearanceFixed64Required positive body height.
portalWaypointsSpan<Vector3d>Caller-owned storage with capacity for twice the portal count.
portalWaypointCountintThe number of canonical portal waypoints written.
geometricCostFixed64The checked fixed-point length of the canonical polyline.
Returns
Remarks
Consecutive cells must share a positive-area face. Vertical faces contribute one portal-center waypoint. Horizontal faces contribute the last point wholly contained by the source cell and the first point wholly contained by the target cell. The resulting polyline and checked length are deterministic and independent of runtime grid identity.