TSEARCH is a MATLAB library which compares several replacements for MATLAB's obsolete tsearch() function, which searched a Delaunay triangulation to find the triangle that encloses a given point.
Given a set of points P, it is possible to compute the Delaunay triangulation D(P), and then to very efficiently answer the question, what triangle T in D(P) contains a query point Q?
In earlier versions of MATLAB, this could be done by the following calls:
d = delaunay ( px, py ); t = tsearch ( px, py, d, qx, qy );
A MATLAB function mytsearch() was written, which allows the user to supply an initial guess for the triangle; if the guess is incorrect, then tsearch() is called to find the correct answer.
d = delaunay ( px, py ); t = guess values; t = tsearch_mex ( px, py, d, qx, qy, t );
A C function has been made available, which follows MATLAB's MEX interface standards, and which can also be used for this computation:
d = delaunay ( px, py ); t = tsearch_mex ( px, py, d, qx, qy );
But now tsearch() has been deleted, and the recommended calls are:
d = DelaunayTri ( p ); t = PointLocation ( d, q);
The main purpose of the files in this directory is to examine the behavior of these various options.
The computer code and data files made available on this web page are distributed under the GNU LGPL license.
TSEARCH is available in a MATLAB version.
MESH2D, a MATLAB library which can automatically create a triangular mesh for a given polygonal region, by Darren Engwirda.
TRIANGULATION, a MATLAB library which performs various operations on order 3 (linear) or order 6 (quadratic) triangulations, including searching a Delaunay triangulation to find which triangle contains a given point.
You can go up one level to the MATLAB source codes.