![]() ![]() It does not require that the triangulation be Delaunay. One alternative is a file called tsearch_mex.c, which searches a triangulation to determine which triangle contains each point. Therefore, the call to tsearch() also causes MESH2D to fail! The tsearch() function has since been removed from MATLAB. The MESH2D function "mytsearch()" was originally written to call MATLAB's "tsearch()" function. (I believe it is intended to generate a "wait bar", similar to the hourglass or beachball or wristwatch icons. The call to this function fails on my system, and since it seems to have no importance whatsoever, I commented it out. The MESH2D routines include a call to a function called wbar(). This copy is essentially my personal working copy, to which I may have added comments, small coding changes, and extra tests and examples. Interested users should refer to the copy of MESH2D that is made available through the MATLAB Central File Exchange. The program relies heavily on the features of the Delaunay triangulation, which chooses, among all possible triangulations of a set of points, that triangulation which best avoids small angles. The density of the triangular mesh can be uniform, or the user can request that smaller triangles be used near certain features of the region. MESH2D is most useful because it allows a user to specify a shape or region, which the program will then fill with a triangular mesh. The user is able to define a variety of geometric shapes, and desired mesh densities. The code is relatively simple, flexible and powerful. MESH2D is a MATLAB program which generates unstructured meshes in 2D, by Darren Engwirda. FINDTRIA makes use of a geometric search tree - an AABB-tree - to speed up the computations.Īs of R2014b, MATLAB also supports queries on non-Delaunay triangulations using the pointLocation routine, though my initial experience seems to suggest that this new inbuilt function can be quite slow when the triangulation is not Delaunay.Automatic 2D Mesh Generation, by Darren Engwirda ![]() While not as fast as MATLAB's inbuilt pointLocation routines (when the underlying triangulation is Delaunay), FINDTRIA is typically much more efficient than doing a brute-force O(n*m) search through each point/triangle pair. FINDTRIA is a toolbox designed to perform point-location queries on arbitrary (d-dimensional) triangulations, including those that are non-Delaunay, non-convex or even overlapping, so it should deal with your triangulation as it is. You might, though, be interested to look into my FINDTRIA routines (available from the MATLAB file exchange). I don't think there's an easy way of getting MATLAB's inbuilt triangulation routines to do this for you - as you note, they explicitly require the triangulation be Delaunay. (This is the case if all the barycentric coordinates are within 0<=bx,by,bz<=1.) The way this works is by computing the barycentric coordinates of your query points with respect to all the triangles/tetrahedra and then using these to check if the points are actually inside of them. Notice that TI is a cell array, as for triangulations one can't be sure they are regular in the sense, that there is only one triangle/tetrahedron containing the point. % Find query point QPs in triangulation trepīarys = trep.cartesianToBarycentric((1:size(trep,1))', repmat(QPs(i,:),size(trep,1),1)) ![]() With the homebrew function pointLocation: function TI = pointLocation(trep, QPs) You can construct a workaround using the methods from the triangulation class: trep = triangulation(tri, x, y) Therefore I would suggest to you the following Workaround:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |