www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/FindEnclosingTetrahedraandBarycentricCoordinatesin3DExample.m
%% Find Enclosing Tetrahedra and Barycentric Coordinates in 3-D %% % Create a 3-D Delaunay triangulation from a set of random points. x = gallery('uniformdata',[20 1],0); y = gallery('uniformdata',[20 1],1); z = gallery('uniformdata',[20 1],2); DT = delaunayTriangulation(x,y,z); %% % Find the tetrahedra that enclose the query points and calculate the barycentric % coordinates of the query points. QP = [0.7 0.6 0.3; 0.5 0.5 0.5]; [ti,B] = pointLocation(DT,QP)