How to define constraints on delaunay triangulation
조회 수: 15 (최근 30일)
이전 댓글 표시
I have a set of boundray points of human foreground and I want the triangle meshes to be inside the boundray
I try the constrianted delaunay triangulation but i didn't know how to define the constriants
this my code
[sPostionX,sPostionY]=find(foregrounds(69).foreground==1);
sPostions=[sPostionX,sPostionY];
boundries=boundary(sPostions,0.97);
plot(sPostions(boundries,1),sPostions(boundries,2));
tri = DelaunayTri(sPostions(boundries,:)); % Delaunay triangulation
hold on
triplot(tri);
댓글 수: 0
답변 (1개)
Naga
2024년 9월 20일
Hi Amal,
To perform Constrained Delaunay Triangulation (CDT) with a set of boundary points, you need to ensure that the triangulation respects the constraints defined by the boundary. MATLAB provides a function called delaunayTriangulation which can be used to achieve CDT by specifying edges that need to be preserved.
Here's how you can modify your code to incorporate constraints:
% Get the boundary indices
boundaries = boundary(sPostions, 0.97);
% Create the edges that represent the boundary
edges = [boundaries, circshift(boundaries, -1)];
% Create a constrained Delaunay triangulation
tri = delaunayTriangulation(sPostions, edges);
% Plot the boundary and triangulation
figure;
plot(sPostions(boundaries, 1), sPostions(boundaries, 2), 'r-', 'LineWidth', 2);
hold on;
triplot(tri);
hold off;
The delaunayTriangulation function takes both the points and the edges, ensuring the triangulation respects the specified constraints.This approach should help you create a triangulation that remains within the specified boundary.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Delaunay Triangulation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!