How can I create a three-dimensional surface from unsorted coordinates in MATLAB 7.4 (R2007a)?

5 次查看(过去 30 天)
I have vectors of X, Y and Z coordinates which are not sorted according to the nearest neighbor criterion. I would like to be able to create and render a surface using this data using in-built functions in MATLAB. Would this data be usable with the SURF function?

采纳的回答

MathWorks Support Team
The function SURF expects a neat rectilinear grid to be supplied to it before it can render the surface. It is not possible to use this function directly to render a surface with unordered coordinates.
As a workaround the function TRISURF can be used to create the surface in conjunction with the DELAUNAY function. The DELAUNAY function performs the triangulation and returns a mx3 matrix "Tri" which defines each triangle used to render the surface. Each row of "Tri" defines a single triangular face by indexing into the vectors or matrices that contain the X, Y, and Z vertices. This "Tri" matrix can then be used with TRISURF to generate the surface.
The following code illustrates the use of DELAUNAY and TRISURF to generate a surface:
load seamount;
tri = delaunay(x,y);
h = trisurf(tri, x, y, z);
axis off
l = light('Position',[-50 -15 29])
set(gca,'CameraPosition',[208 -50 7687])
lighting phong
shading interp
colorbar EastOutside
axis vis3d

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Delaunay Triangulation 的更多信息

产品


版本

R2007a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by