Class DistanceGrid
A 3D spatial grid storing scalar distance values (typically SDFs).
Inherited Members
Namespace: ZLab.Discrete.Grids
Assembly: ZLab.Discrete.dll
Syntax
public sealed class DistanceGrid : GridBase, IGrid<float>, IGridMeta
Constructors
| Name | Description |
|---|---|
| DistanceGrid(Vector3, BBox) | Initializes a distance grid covering the specified bounds. |
| DistanceGrid(GridMeta) | Initializes an empty distance grid with given metadata. |
| DistanceGrid(OccupancyGrid) | Initializes a distance grid based on the dimensions of an occupancy grid. |
Methods
| Name | Description |
|---|---|
| AddOffset(float) | Add a constant offset to all distances (e.g., morph iso-surface). |
| BuildFromBinaryMask(ReadOnlySpan<byte>, bool) | Compute exact Euclidean SDF (positive outside, negative inside) from a binary mask. The binary mask is row-major with x-fastest layout; length must be NxNyNz. |
| BuildFromTernaryMask(ReadOnlySpan<byte>, bool) | Compute exact Euclidean SDF (positive outside, negative inside) from a ternary mask. |
| Clone() | Deep clone of this grid. |
| Fill(float) | Fill all distances with a constant value. |
| GetArrayUnsafe() | Get internal data array. |
| GetBuffer() | Get all distance values as a mutable span (flat row-major array). |
| GetMinMax() | Get minimum and maximum distance values in the grid. |
| GetReadOnlyBuffer() | Get all distance values as a read-only span (flat row-major array). |
| GetReadOnlyMemory() | Get all distance values as a read-only memory (flat row-major array). |
| GetValue(Vector3) | Get distance value at given world position. |
| GetValue((int x, int y, int z)) | Get distance value at given grid index. |
| SetValue(ReadOnlySpan<float>) | Set distance values from an existing flat array (row-major order). |
| SetValue((int x, int y, int z), float) | Set distance value at given grid index. |
| ToString() | String representation of the grid. |