Be the first to rate this file! 15 Downloads (last 30 days) File Size: 1.73 KB File ID: #33226

Compute STL Vertex Normals

by Francis Esmonde-White

 

11 Oct 2011

Find the per-vertex normals for a tesselated surface.

| Watch this File

File Information
Description

The default normal vectors associated with tesselated surfaces are computed for each triangle face. Some purposes (like nice rendering) require per-vertex normals instead. These are typically calculated by averaging the face normals. This function offers two methods, first, an average normal weighted by triangle area, and second the normal as an average of the surrounding triangle faces. The second option is faster (because it uses the pre-computed unit-normals), but the first method generates nicer surface-normals, particularly at regions with sharp edges or small triangles.

This should do essentially the same thing as Dirk-Jan Kroon's 'Patch Normals' submission #24330, and my code is probably slower because it is not compiled. However, it's a bit simpler to read and (hopefully) to use.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Patch Normals, Binary STL file reader

MATLAB release MATLAB 7.13 (2011b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
stl Francis Esmonde-White 12 Oct 2011 11:56:10
normal Francis Esmonde-White 12 Oct 2011 11:56:10
vertex normal Francis Esmonde-White 12 Oct 2011 11:56:10
rendering Francis Esmonde-White 12 Oct 2011 11:56:10
tesselated surface Francis Esmonde-White 12 Oct 2011 11:56:10

Contact us at files@mathworks.com