How to create a triangulation from a list of edges and list of nodes?

8 ビュー (過去 30 日間)
Dominik Mattioli
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.
dt.ConnectivityList(:,2:3);...
dt.ConnectivityList(:,[3 1])],...
2),'rows');
figure; triplot(dt);
% Convert dt to graph, plot.
g = graph(edges(:,1),edges(:,2));
figure; g.plot;
% We know that g.edges describe dt, how can we reconstruct it?

採用された回答

Johannes Korsawe
Johannes Korsawe 2022 年 10 月 14 日
allCyclesWithLengthThree = allcycles(g, 'MaxCycleLength', 3);
connectivityList = cell2mat(allCyclesWithLengthThree);

その他の回答 (1 件)

Christine Tobler
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 件のコメント
Dominik Mattioli
Dominik Mattioli 2018 年 8 月 14 日
編集済み: Dominik Mattioli 2018 年 8 月 14 日
Your suggestion is the most intuitive, however, I imagine that being expensive for very large graphs unless it is done very cleverly. I think that the constraints I've given to the problem help with the problem's complexity.
In a nutshell, I will be using the graph class to selectively removing edges from the triangulation (as a graph) to form quadrilaterals.
Basically: create triangulation -> convert to graph -> remove edges to form some quads -> convert back to tri/quad/mixed 'rangulation'.
P.S. I've coded a triangulation class that accommodates quadrilaterals.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDelaunay Triangulation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by