How to create a triangulation from a list of edges and list of nodes?
조회 수: 18(최근 30일)
표시 이전 댓글
Dominik Mattioli 2018년 7월 29일
답변: Johannes Korsawe 2022년 10월 14일
I'm beginning with a triangulation so that I know this graph is actually composed of non-intersecting edges that define a set of triangles.
% Start with a random triangulation, get edge list.
dt = delaunayTriangulation(rand(101,2)); % Keep it small for now.
edges = unique(sort(... % Unique mx2 list of
[dt.ConnectivityList(:,1:2);... % all edges in dt.
% Convert dt to graph, plot.
g = graph(edges(:,1),edges(:,2));
% We know that g.edges describe dt, how can we reconstruct it?
Christine Tobler 2018년 8월 9일
The problem is that a graph is a more general data structure than a Delaunay triangulation. Many graphs do not represent a triangulation at all, so there is not direct way of doing this.
If you also save the locations of each point in the original triangulation, you could write an algorithm that goes through each point in the graph and finds all the triangles it's a part of.
Could you tell me why you want to retrieve the triangulation from the graph?
댓글 수: 1
Johannes Korsawe 2022년 10월 14일
allCyclesWithLengthThree = allcycles(g, 'MaxCycleLength', 3);
connectivityList = cell2mat(allCyclesWithLengthThree);
Find more on Delaunay Triangulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!