版本 (3.5 KB) 作者: Dirk-Jan Kroon
Convert a triangulated mesh into a voxel volume

6.5K 次下载

更新时间 2019/5/20


编者注: This file was selected as MATLAB Central Pick of the Week

This function polygon2function will convert a Triangulated Mesh into a Voxel Volume which will contain the discretized mesh.

Discretization of a polygon is done by splitting the polygon in smaller polygons, until the longest edge is smaller than 0.5 voxel, then the voxel beneath the vertice coordinates is set to one.

Note, this new version is pure Matlab (previous version required c++ compiler)

Try the example.

Bugs, successes and other comments are welcome!


Dirk-Jan Kroon (2023). Polygon2Voxel (https://www.mathworks.com/matlabcentral/fileexchange/24086-polygon2voxel), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2009a
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明

pure Matlab (previous version required c++ compiler)

Function now also working without compiling c-code

Added boundary options

Now first index volume is 1,1,1 instead of 0,0,0, and YXZ dimensions as in Matlab convention (Thanks Yuanming SUO).

Changed output to Logicals instead of Double datatype

Small Bug fixed, for the case if all vertices are outside the volume. Only not draw the face if they are outside at the same side of the volume.

Linux Ubuntu Tested

Added center and resize options