View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Fast Loop mesh subdivision

5.0 | 2 ratings Rate this file 13 Downloads (last 30 days) File Size: 5.32 KB File ID: #32727 Version: 1.5
image thumbnail

Fast Loop mesh subdivision


Dylan Muir (view profile)


29 Aug 2011 (Updated )

Subdivide a surface mesh, using Loop subdivision. Boundary- and shape-maintaining

| Watch this File

File Information

Usage: [mfRefinedMesh, mnTriangulation] = LoopSubdivisionLimited( mfMeshPoints, mnTriangulation, fMinResolution, vbBoundaryEdges)
This function sub-divides surface meshes, using the Loop subdivision algorithm [1]. This algorithm is based on B-spline curve continuity, leading to good shape-maintaining smoothing of a surface. The algorithm attempts to leave the boundary of the surface essentially undistorted.

'mfMeshPoints' is an Nx3 matrix, each row of which ['x' 'y' 'z'] defines a point in three-dimensional space. 'mnTriangulation' is a Mx3 matrix, each row of which ['m' 'n' 'p'] defines a triangle existing on the surface, where 'm', 'n' and 'p' are indices into 'mfMeshPoints'.

'fMinResolution' defines the desired minimum length of an edge in the final subdivision. Edges shorter than 'fMinResolution' will not be divided further.

The optional argument 'vbBoundaryEdges' identifies which edges should be treated as boundary edges (and so should their locations should be attempted to be maintained by the algorithm). This argument will be calculated by the algortihm, if it is not supplied.

'mfRefinedMesh' will be a Px3 matrix, each row of which specifies a vertex in the subdivided mesh. 'mnTringulation' will be a Rx3 matrix, each row of which specifies a surface triangle in the subdivided mesh.

Algorithm from [1].

If you work out how to maintain the vertex and edge adjacency matrices through a full subdivision run, then great! That would speed up subsequent runs a great deal, since a lot of the time is spent computing the edge adjacency matrix...

[1] Loop, C 1987. "Smooth subdivision surfaces based on triangles." M.S. Mathematics thesis, University of Utah.

MATLAB release MATLAB 7.8 (R2009a)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
23 Aug 2016 Albert Pun

Exactly what I wanted

21 Oct 2014 Dylan Muir

Dylan Muir (view profile)

Thanks for your comment, Anton.

Comment only
20 Oct 2014 Alec Jacobson

This code uses for loops (parallelized with parfor) over the mesh elements. A much faster alternative avoiding for loops can be found here: see `mesh/loop.m`

Comment only
27 Aug 2014 Anton Semechko

Anton Semechko (view profile)

This function gets the job done a lot faster than another Loop subdivision function on FEX: . Great job Dylan!

07 Jul 2014 Dylan Muir

Dylan Muir (view profile)

Hi Naive, the vertex order depends on the underlying triangulation functions, which are not under my control.

Comment only
27 Dec 2013 naive

naive (view profile)

Hi Dylan,
This is a quite useful function. Thanks so much! However, when I plot the mfRefinedMesh, I feel that the vertices of a triangle are not always in the same order, either all in clockwise or counterclockwise, but I am not 100% percent sure. Am I right?

Comment only
27 Mar 2013 Dylan Muir

Dylan Muir (view profile)

Hi Dun,

I would be happy to include your improvements if you send them to me; my email address is my last name at


Comment only
27 Mar 2013 Dun Kirk

After adding a few tricks, it takes only 0.861 seconds from 223 triangles to 228352 triangles (5x subdivisions).

Comment only
23 Mar 2013 Dun Kirk

Making use of the Matlab embedded data structure: TriRep could make this a lot faster. This function took 206.36 seconds subdividing 122 triangles to 124928 triangles (5 times subdivision). I did it in 2.2 seconds with TriRep.

Comment only
29 Feb 2012 Dylan Muir

Dylan Muir (view profile)

Hi Jaroslaw,

The Loop subdivision algorithm provides mesh smoothing and refinement:

Certainly the original mesh points are not preserved. That's not how the algorithm works.


Comment only
28 Feb 2012 Jaroslaw Tuszynski

This function does not seem to work for me. The output mesh does not resemble much the input mesh. I was expecting that all the original points would be preserved, but that is not the case.

Comment only
30 Sep 2011 1.1

* Fixed a bug that occurred if some points did not appear in the triangulation.

* Updated help text and description to include 'fMinResolution' argument

* Updated image

07 Nov 2011 1.2

Updated description

09 Nov 2011 1.3

Updated function to include resolution limiting version.

18 Jun 2014 1.4

Updated summary

22 Sep 2016 1.5

Updated usage formatting

04 Oct 2016 1.5

Updated description

24 Oct 2016 1.5

Updated description

13 Dec 2016 1.5

Updated description

Contact us