Voxel2mesh - plotVoxelArray
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 (2025). Voxel2mesh - plotVoxelArray (https://www.mathworks.com/matlabcentral/fileexchange/75240-voxel2mesh-plotvoxelarray), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.1.0 | Colour Update
|
||
1.0.4 | small changes to the description |
||
1.0.3 | fixed some comments |
||
1.0.2 | . |
||
1.0.1 | . |
||
1.0.0 |