Class Voxelize

Public

Voxelizer for recast graphs.

In comments: units wu are World Units, vx are Voxels

A* Pro Feature:

This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited.
The Pro version can be bought here

Public Methods

BoxBlur (src, dst)
Public
BuildCompactField ()
Public
BuildContours (maxError, maxEdgeLength, cset, buildFlags)
Public
BuildDistanceField ()
Public
BuildPolyMesh (cset, nvp, mesh)

Builds a polygon mesh from a contour set.

Public
BuildRegions ()
Public
BuildVoxelConnections ()
Public
CalcAreaOfPolygon2D (verts, nverts)
Public
CalculateDistanceField (src)
Public
CompactSpanToVector (x, z, i)
Public
DebugDrawSpans ()
Public
ErodeVoxels (radius)
Public
ErodeWalkableArea (radius)
Public
FilterLedges (voxelWalkableHeight, voxelWalkableClimb, cs, ch)
Public
FilterLowHeightSpans (voxelWalkableHeight, cs, ch)
Public
FilterSmallRegions (reg, minRegionSize, maxRegions)

Filters out or merges small regions.

Public
FloodRegion (x, z, i, level, r, srcReg, srcDist, stack, flags=null, closed=null)
Public
GetCornerHeight (x, z, i, dir, isBorderVertex)
Public
Init ()
Public
MarkRectWithRegion (minx, maxx, minz, maxz, region, srcReg)
Public
RemoveDegenerateSegments (simplified)
Public
SimplifyContour (verts, simplified, maxError, maxEdgeLenght, buildFlags)
Public
VectorToIndex (p, x, z)
Public
VoxelToWorld (x, y, z)

Convert from voxel coordinates to world coordinates.

Public
VoxelToWorldInt3 (voxelPosition)

Convert from voxel coordinates to world coordinates.

Public
Voxelize (ch, cs, walkableClimb, walkableHeight, maxSlope, maxEdgeLength)
Public
VoxelizeInput (graphTransform, graphSpaceBounds)
Public
WalkContour (x, z, i, flags, verts)
Public

Public Static Methods

Area2 (a, b, c, verts)
Public Static
Collinear (a, b, c, verts)
Public Static
Diagonal (i, j, n, verts, indices)

Returns T iff (v_i, v_j) is a proper internal diagonal of P.

Public Static
Ileft (a, b, c, va, vb, vc)
Public Static
InCone (i, j, n, verts, indices)
Public Static
IntersectProp (a, b, c, d, verts)
Public Static
Left (a, b, c, verts)

Returns true iff c is strictly to the left of the directed line through a to b.

Public Static
LeftOn (a, b, c, verts)
Public Static
MergeContours (ca, cb, ia, ib)
Public Static
Next (i, n)

(i+1) % n assuming 0 <= i < n

Public Static
Prev (i, n)

(i-1+n) % n assuming 0 <= i < n

Public Static
Xorb (x, y)
Public Static

Public Variables

borderSize

The size of the non-navigable border around the heightfield.

Public
cellHeight

The y-axis cell size to use for fields.

Public Readonly
cellSize

The xz-plane cell size to use for fields.

Public Readonly
countourSet
Public
depth

Depth in voxels.

Public
forcedBounds

The world AABB to rasterize.

Public
inputMeshes
Public
maxEdgeLength

The maximum allowed length for contour edges along the border of the mesh.

Public
maxSlope

The maximum slope that is considered walkable.

Public
minRegionSize
Public
relevantGraphSurfaceMode
Public
transformVoxel2Graph

Transform from voxel space to graph space.

Public
voxelArea
Public
voxelWalkableClimb

Maximum ledge height that is considered to still be traversable.

Public Readonly
voxelWalkableHeight

Minimum floor to 'ceiling' height that will still allow the floor area to be considered walkable.

Public Readonly
width

Width in voxels.

Public

Public Static Variables

NotConnected
Public Static
RC_CONTOUR_TESS_AREA_EDGES

Tessellate edges between areas.

Public Static
RC_CONTOUR_TESS_TILE_EDGES

Tessellate edges at the border of the tile.

Public Static
RC_CONTOUR_TESS_WALL_EDGES

Tessellate wall edges.

Public Static

Private/Protected Members

Between (a, b, c, verts)
Private Static
BorderReg

If heightfield region ID has the following bit set, the region is on border area and excluded from many calculations.

Private Static
ContourRegMask

Mask used with contours to extract region id.

Private Static
ConvertPosWithoutOffset (x, y, z)
Private
ConvertPosition (x, z, i)
Private
Diagonalie (i, j, n, verts, indices)

Returns T iff (v_i, v_j) is a proper internal *or* external diagonal of P, *ignoring edges incident to v_i and v_j*.

Private Static
DrawLine (a, b, indices, verts, color)
Private
GetClosestIndices (vertsa, nvertsa, vertsb, nvertsb, ia, ib)
Private
Intersect (a, b, c, d, verts)
Private Static
MaxLayers

Unmotivated variable, but let's clamp the layers at 65535.

Private Static
MaxRegions
Private Static
RC_AREA_BORDER
Private Static
RC_BORDER_VERTEX

If contour region ID has the following bit set, the vertex will be later removed in order to match the segments and vertices at tile boundaries.

Private Static
ReleaseContours (cset)

Releases contents of a contour set to caches.

Private Static
Triangulate (n, verts, indices, tris)
Private
UnwalkableArea
Private Static
VERTEX_BUCKET_COUNT
Private Static
Vequal (a, b, verts)
Private Static
cellScale
Private Readonly
transform

Transform from voxel space to world space.

Private
union_find_find (arr, x)

Find method in the UnionFind data structure.

Private Static
union_find_union (arr, a, b)

Join method in the UnionFind data structure.

Private Static
voxelOffset
Private