Converting TriRep to DelaunayTri while using pointLocation?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
hi, I have a TriRep object with triangulations and I want to use pointLocation on the object to find whether the points are inside the triangles. But the pointLocation is a method defined for DelaunayTri class which is a subclass of TriRep. So I would like to ask if TriRep object can be converted to DelaunayTri to be used in pointLocation?
0 Kommentare
Antworten (1)
Divyam
am 8 Okt. 2024
The "DelaunayTri " object can be created using the extracted points from the "TriRep" object. As of MATLAB R2024b, "DelaunayTri " class is not recommended for usage and it's preferable to use the "delaunayTriangulation" class instead.
% Assume T is your TriRep object
T = TriRep([1, 2, 3; 1, 3, 4], [0, 0; 1, 0; 0, 1; 1, 1]);
% Extract the points
points = T.X;
% Create a DelaunayTri object
delaunayTriObj = DelaunayTri(points);
% Define points to check
P = [0.5, 0.5; 0.75, 0.75; 0.25, 0.25];
% Use pointLocation to find the triangles containing the points
triangleIndices = pointLocation(delaunayTriObj, P);
% Display the results
fprintf('Triangle indices for the query points: [%s]\n', join(string(triangleIndices),','));
For more information regarding the "delaunayTriangulation" class, refer to the following documentation: https://www.mathworks.com/help/matlab/ref/delaunaytriangulation.html
0 Kommentare
Siehe auch
Kategorien
Mehr zu Industrial Statistics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!