ZLab.Discrete ZLab.Discrete
ZLab.Discrete ZLab.Discrete
Developed by Zeke Zhang

Search Results for

    Edit this page

    Method WorldToVoxelIndexInclusive

    | Edit this page View Source

    WorldToVoxelIndexInclusive(Vector3, Vector3)

    Converts world position to voxel grid index for bounding box maximum coordinates. Use for inclusive bounds.

    Declaration
    public static (int x, int y, int z) WorldToVoxelIndexInclusive(Vector3 worldPosition, Vector3 voxelSize)
    Parameters
    Type Name Description
    Vector3 worldPosition

    The world position to convert (typically a bounding box maximum)

    Vector3 voxelSize

    The size of each voxel in world units

    Returns
    Type Description
    (int x, int y, int z)

    The (x, y, z) grid indices of the voxel containing the position

    | Edit this page View Source

    WorldToVoxelIndexInclusive(Vector3, Vector3, Vector3)

    Converts world position to voxel grid index for bounding box maximum coordinates with custom grid origin. Use for inclusive bounds.

    Declaration
    public static (int x, int y, int z) WorldToVoxelIndexInclusive(Vector3 worldPosition, Vector3 voxelSize, Vector3 gridOrigin)
    Parameters
    Type Name Description
    Vector3 worldPosition

    The world position to convert (typically a bounding box maximum)

    Vector3 voxelSize

    The size of each voxel in world units

    Vector3 gridOrigin

    The world position of the grid's origin (minimum corner of voxel (0,0,0))

    Returns
    Type Description
    (int x, int y, int z)

    The (x, y, z) grid indices of the voxel containing the position