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
2009-6-27
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Delaunay Triangulation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!