Obi  6.4
Unified particle physics for Unity
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Obi.MeshVoxelizer Class Reference

Public Types

enum  Voxel { Empty = 0, Inside = 1 << 0, Boundary = 1 << 1, Outside = 1 << 2 }
 

Public Member Functions

 MeshVoxelizer (Mesh input, float voxelSize)
 
float GetDistanceToNeighbor (int i)
 
int GetVoxelIndex (int x, int y, int z)
 
Vector3 GetVoxelCenter (in Vector3Int coords)
 
List< int > GetTrianglesOverlappingVoxel (int voxelIndex)
 
Vector3Int GetPointVoxel (in Vector3 point)
 
bool VoxelExists (in Vector3Int coords)
 
bool VoxelExists (int x, int y, int z)
 
IEnumerator Voxelize (Matrix4x4 transform, bool generateTriangleIndices=false)
 
void BoundaryThinning ()
 

Static Public Member Functions

static bool IsIntersecting (in Bounds box, Vector3 v1, Vector3 v2, Vector3 v3)
 

Public Attributes

Mesh input
 
float voxelSize
 
Vector3Int resolution
 

Static Public Attributes

static readonly Vector3Int[] fullNeighborhood
 
static readonly Vector3Int[] edgefaceNeighborhood
 
static readonly Vector3Int[] faceNeighborhood
 
static readonly Vector3Int[] edgeNeighborhood
 
static readonly Vector3Int[] vertexNeighborhood
 

Properties

Vector3Int Origin [get]
 
int voxelCount [get]
 
Voxel this[int x, int y, int z] [get, set]
 

Detailed Description

Helper class that voxelizes a mesh.

Member Data Documentation

readonly Vector3Int [] Obi.MeshVoxelizer.edgefaceNeighborhood
static
Initial value:
=
{
new Vector3Int(-1,-1,0),
new Vector3Int(-1,0,-1),
new Vector3Int(-1,0,0),
new Vector3Int(-1,0,1),
new Vector3Int(-1,1,0),
new Vector3Int(0,-1,-1),
new Vector3Int(0,-1,0),
new Vector3Int(0,-1,1),
new Vector3Int(0,0,-1),
new Vector3Int(0,0,1),
new Vector3Int(0,1,-1),
new Vector3Int(0,1,0),
new Vector3Int(0,1,1),
new Vector3Int(1,-1,0),
new Vector3Int(1,0,-1),
new Vector3Int(1,0,0),
new Vector3Int(1,0,1),
new Vector3Int(1,1,0)
}
readonly Vector3Int [] Obi.MeshVoxelizer.edgeNeighborhood
static
Initial value:
=
{
new Vector3Int(-1,-1,0),
new Vector3Int(-1,0,-1),
new Vector3Int(-1,0,1),
new Vector3Int(-1,1,0),
new Vector3Int(0,-1,-1),
new Vector3Int(0,-1,1),
new Vector3Int(0,1,-1),
new Vector3Int(0,1,1),
new Vector3Int(1,-1,0),
new Vector3Int(1,0,-1),
new Vector3Int(1,0,1),
new Vector3Int(1,1,0)
}
readonly Vector3Int [] Obi.MeshVoxelizer.faceNeighborhood
static
Initial value:
=
{
new Vector3Int(-1,0,0),
new Vector3Int(1,0,0),
new Vector3Int(0,-1,0),
new Vector3Int(0,1,0),
new Vector3Int(0,0,-1),
new Vector3Int(0,0,1)
}
readonly Vector3Int [] Obi.MeshVoxelizer.vertexNeighborhood
static
Initial value:
=
{
new Vector3Int(-1,-1,-1),
new Vector3Int(-1,-1,1),
new Vector3Int(-1,1,-1),
new Vector3Int(-1,1,1),
new Vector3Int(1,-1,-1),
new Vector3Int(1,-1,1),
new Vector3Int(1,1,-1),
new Vector3Int(1,1,1)
}

The documentation for this class was generated from the following file: