3

Is there any subroutine, in MATLAB, that takes in a list of points, and return me a good mesh that I can use to show to my colleagues, such as this?

alt text

Actually, all I need is just a simple 2D mesh generator that takes in a series of X, Y coordinates (that defines the boundary of the area), and give me back a list of elements that can mesh that area well. I can do the rest by using MATLAB command to interpolate the Z value.

Edit : I am not interested to use MATLAB to produce the above looking plot. I am interested in using a MATLAB library to obtain a list of elements so that when I plot those element myself (not in MATLAB itself; but in my own C# program), I can obtain this meshed surface.

PS: I know there is this DistMesh, but I am looking for something simpler - something built-in direct in MATLAB perhaps. And no, meshgrid is not mesh generation.

Community
  • 1
  • 1
Graviton
  • 81,782
  • 146
  • 424
  • 602
  • 3
    The figure you show may be misleading. If I understand correctly, you are starting with a set of points defining a boundary of a region. Do you then want to generate a triangular mesh that creates more points *within* that region? – gnovice Nov 07 '09 at 03:13
  • 1
    Yes, I want to generate a triangular mesh that creates more points within that region – Graviton Nov 07 '09 at 05:51

5 Answers5

6

It sounds like you want to create a finite element mesh, starting with a set of points defining a boundary of a region and then generating a triangular mesh that creates more points within that region. I don't think there's a "simple" solution for this problem.

The closest "built-in" solution would probably be the Partial Differential Equation Toolbox, specifically some of the Geometry Algorithms like INITMESH and REFINEMESH.

The link you gave to DistMesh appears to be another good solution. There are also a few submissions on the MathWorks File Exchange that you could take a look at:

gnovice
  • 125,304
  • 15
  • 256
  • 359
  • Persson's pure Matlab DistMesh might be of interest as well: http://persson.berkeley.edu/software.html for heavy duty meshing, however, I would write the code to a csv file and do a system call to Shewchuk's triangle, however: http://www.cs.cmu.edu/~quake/triangle.html – shabbychef Dec 08 '09 at 01:22
1
  • That picture looks exactly like the one from the griddata documentation. The example in there looks like what you want.
  • SFTOOL will easily make the picture that you show.
  • A thin-plate spline, e.g., TPAPS, should also do the job.
ManWithSleeve
  • 2,647
  • 2
  • 15
  • 5
  • sftool is definitely not what I want, whereas the TPAPS seems more applicable to obtain a general big thin surface rather than meshed surfaces. – Graviton Nov 06 '09 at 11:57
1

I think the user-created 'gridfit' is the best I've come across for a single surface, much better/prettier than griddata.

James
  • 13
  • 1
  • 4
0

Mesh generation as in Delaunay Triangulation + Steiner Points? There is a builtin Delaunay function in MATLAB.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
shabbychef
  • 1,940
  • 3
  • 16
  • 28
0

If your surface is the z=f(x,y) form you can use:

http://www.advancedmcode.org/how-to-plot-a-coloured-surface-from-3d-scatter.html

If your surface is concave look for surface reconstruction on the same website.