File Exchange

image thumbnail

Improved surface smooth

version 1.0.0 (6.88 KB) by Chong WU
This work is an improved version of the work done by Marc Lalancette, 2014-02-04.


Updated 04 Oct 2018

View License

New features 2018.10.4
1. The new input variable "ViewPoint (default [0,0,0])" will help to control
the normal direction and reduce the error caused by inconsistent
normal direction. If you want to make all normals inward, you could choose a point
inside the closed 3D shape.
2. Through making every edge distinct in one direction to solve the
sparse error problem.
3. Solved an error which the code will not work and return the output with all NaN
in a case when some vertices are not in faces.

With these above improvements, the code is now more general to use.

Improved by Chong Wu, City University of Hong Kong, Hong Kong SAR, China, 2018.10.4

Improved the normal calculation, revised the sparse error, and NaN error. The original work by Marc Lalancette, Toronto, Canada, 2014-02-04 is:

Cite As

Chong WU (2020). Improved surface smooth (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)


Still, the sparse problem appears.

Error using sparse
Index into matrix must be positive.

Error in SurfaceSmooth (line 173)
C = sparse(edge(:,1), edge(:,2), true);

Error in shapeA (line 56)
SurfaceSmooth(F2, V2, 1, [0 0 0],0.01, 100, 2, 0);


Hi, I'm a beginner
I've been smoothing SST data but the result is still not good
I think your script will helpfully but I don't understand how to use it
Would you like to give me some examples
Many Thanks

jiawang Cao

It's a really good work!


It really works well!


great, it is just what i need!

MATLAB Release Compatibility
Created with R2018b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Volume of a surface triangulation, SurfaceSmooth