MATLAB Answers

apex116
0

Creating a Regular Delanuy Triangulation.

Asked by apex116
on 29 Oct 2018
Latest activity Commented on by apex116
on 1 Nov 2018
Hello, I would like to create a Delanuy Triangulation like below:
Only difference with my code is that the x and y intervals are different.
Here are the steps I have taken so far. I have set the limits to the triangulation:
minX = 2.58 * 1E5;
maxX = 2.8 * 1E5;
minY = 1.82 * 1E5;
maxY = 1.93 * 1E5;
I have then calculated the distance between the limits:
Xdiff = maxX - minX;
Ydiff = maxY - minY;
Set the ratio between the two:
Ratio = Ydiff/Xdiff;
I have then prescribed the number of x points and then multiplied the number of y points by the previous ratio.
NumPointsX = 220;
NumPointsY = NumPointsX * Ratio;
I then calculate the intervals:
XSep = Xdiff/NumPointsX;
YSep = Ydiff/NumPointsY * Ratio;
using the interval and limits, I can then assign an even number of x and y points.
x = (minX:XSep:maxX)';
y = (minY:YSep:maxY)';
and then I use the Delanuy Triangulation.
DT = delaunayTriangulation(x,y);
Upon doing so, I am unable to obtain a connectivity list and believe there is an error in my code. I don't know if anyone could help me with this issue so that I can create a regular Delanuy triangulation.
Many Thanks
Paul

  0 Comments

Sign in to comment.

1 Answer

Answer by jonas
on 29 Oct 2018
Edited by jonas
on 29 Oct 2018
 Accepted Answer

The triangulation is not where your problem is. Before you triangulate, you need to have a grid, which you do not. Try plotting x against y and you can see that you a straight line. You probably want to use meshgrid for creating your grid.
[X,Y] = meshgrid(x,y);
DT = delaunayTriangulation(X(:),Y(:));
DT =
delaunayTriangulation with properties:
Points: [48841×2 double]
ConnectivityList: [96800×3 double]
Constraints: []
You can then simply plot
triplot(DT)

  1 Comment

yes that solved the problem. Thank you for your help, much appreciated.

Sign in to comment.