Triangulation and Interpolation of Scattered Data
MATLAB provides routines that aid in the analysis of closest-point problems and geometric analysis.
||3-D Delaunay tessellation.
||Nearest point search of Delaunay triangulation.
||True for points inside polygonal region.
||Area of polygon.
||Area of intersection for two or more rectangles.
||Closest triangle search.
This section applies the following techniques to the
seamount data set supplied with MATLAB:
See also Tessellation and Interpolation of Scattered Data in Higher Dimensions.
Examples in this section use the MATLAB |
convhull function returns the indices of the points in a data set that comprise the convex hull for the set. Use the
plot function to plot the output of
This example loads the
seamount data and plots the longitudinal (
x) and latitudinal (
y) data as a scatter plot. It then generates the convex hull and uses
plot to plot the convex hull.
Given a set of coplanar data points, Delaunay triangulation is a set of lines connecting each point to its natural neighbors. The
delaunay function returns a Delaunay triangulation as a set of triangles such that no data points are contained in any triangle's circumcircle.
You can use
triplot to print the resulting triangles in two-dimensional space. You can also add data for a third dimension to the output of
delaunay and plot the result as a surface with
trisurf, or as a mesh with
Plotting a Delaunay Triangulation. To try
delaunay, load the
seamount data set and view the longitude (
x) and latitude (
y) data as a scatter plot.
Apply Delaunay triangulation and use
triplot to overplot the resulting triangles on the scatter plot.
Mesh and Surface Plots. Add the depth data (
seamount, to the Delaunay triangulation, and use
trimesh to produce a mesh in three-dimensional space. Similarly, you can use
trisurf to produce a surface.
Contour Plots. This code uses
contour to produce a contour plot of the
The arguments for meshgrid encompass the largest and smallest
y values in the original
seamount data. To obtain these values, use
Closest-Point Searches. You can search through the Delaunay triangulation data with two functions:
dsearchfinds the indices of the
(x,y)points in a Delaunay triangulation closest to the points you specify. This code searches for the point closest to (211.32, -48.35) in the triangulation of the
tsearch, finds the indices into the
delaunayoutput that specify the enclosing triangles of the points you specify. This example uses the index of the enclosing triangle for the point (211.32, -48.35) to obtain the coordinates of the vertices of the triangle.
Voronoi diagrams are a closest-point plotting technique related to Delaunay triangulation.
For each point in a set of coplanar points, you can draw a polygon that encloses all the intermediate points that are closer to that point than to any other point in the set. Such a polygon is called a Voronoi polygon, and the set of all Voronoi polygons for a given point set is called a Voronoi diagram.
voronoi function can plot the cells of the Voronoi diagram, or return the vertices of the edges of the diagram. This example loads the
seamount data, then uses the
voronoi function to produce the Voronoi diagram for the longitudinal (
x) and latitudinal (
y) dimensions. Note that
voronoi plots only the bounded cells of the Voronoi diagram.
See the |
|Interpolation and Multidimensional Arrays||Tessellation and Interpolation of Scattered Data in Higher Dimensions|