Voxel2mesh - plotVoxelArray

Creates and/or displays triangulated or quad mesh from binary or numeric arrays.
191 Downloads
Updated 29 May 2020

View License

There are several functions with similar results on the FileExchange. Compared to the functions I have tested this version is faster (it uses fewer for-loops/iterations) and more compatible with very displaying large arrays (it does not involve the construction of expanding intermediary arrays).

Voxel2mesh - creates triangulated or quad mesh from voxel arrays; the
mesh represents the surface faces of boundary voxels in the input array
(i.e. each voxel face, facing the outside of the object. Voxels are treated as 1x1x1 cubes, cube-faces facing the "outside of the object" are part of the output mesh)

all voxels with value > 0 are considered as part of the object
all voxels with value == 0 are considered background/outside the object

optionally a vector that assigns the numeric value (greyscale) of each voxel to the corresponding mesh vertices can be saved (e.g. to define mesh colours for display)

mesh triangles follow the right-hand rule with face normals pointing
outwards

plotVoxelArray - calls Voxel2mesh to display voxel array as patch object
the colour of the output mesh can be defined manually or by the voxel array (by default the mesh is blue)

Cite As

J. Benjamin Kacerovsky (2024). Voxel2mesh - plotVoxelArray (https://www.mathworks.com/matlabcentral/fileexchange/75240-voxel2mesh-plotvoxelarray), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0

Colour Update
– added options for Voxel2mesh to save a vector of vertex colours defined by the numeric values of the voxel array
– added option to plot to plotVoxelArray to define mesh colours manually (as string or RGB) or from the voxel array

1.0.4

small changes to the description

1.0.3

fixed some comments

1.0.2

.

1.0.1

.

1.0.0