Main Content


Class: DelaunayTri

(Not recommended) Simplex containing specified location



pointLocation(DelaunayTri) is not recommended. Use pointLocation(triangulation) instead.

DelaunayTri is not recommended. Use delaunayTriangulation instead.


SI = pointLocation(DT,QX)
SI = pointLocation(DT,QX,QY)
SI = pointLocation(DT,QX,QY,QZ)
[SI, BC] = pointLocation(DT,...)


SI = pointLocation(DT,QX) returns the indices SI of the enclosing simplex (triangle/tetrahedron) for each query point location in QX. The enclosing simplex for point QX(k,:) is SI(k). pointLocation returns NaN for all points outside the convex hull.

SI = pointLocation(DT,QX,QY) and SI = pointLocation(DT,QX,QY,QZ) allow the query point locations to be specified in alternative column vector format when working in 2-D and 3-D.

[SI, BC] = pointLocation(DT,...) returns the barycentric coordinates BC.

Input Arguments

DTDelaunay triangulation.
QXMatrix of size mpts-by-ndim, mpts being the number of query points.

Output Arguments

SIColumn vector of length mpts containing the indices of the enclosing simplex for each query point. mpts is the number of query points.
BCBC is a mpts-by-ndim matrix, each row BC(i,:) represents the barycentric coordinates of QX(i,:) with respect to the enclosing simplex SI(i).


Example 1

Create a 2-D Delaunay triangulation:

X = rand(10,2);
dt = DelaunayTri(X);
Find the triangles that contain specified query points:
qrypts = [0.25 0.25; 0.5 0.5];
triids = pointLocation(dt, qrypts)

Example 2

Create a 3-D Delaunay triangulation:

x = rand(10,1); 
y = rand(10,1); 
z = rand(10,1);
dt = DelaunayTri(x,y,z);
Find the triangles that contain specified query points and evaluate the barycentric coordinates:
qrypts = [0.25 0.25 0.25; 0.5 0.5 0.5];
[tetids, bcs] = pointLocation(dt, qrypts)