MATLAB Answers


Triangulation within specified region

Asked by Robin Pillar on 7 Jun 2019
Latest activity Commented on by KSSV
on 11 Jun 2019
Accepted Answer by KSSV
I am trying to triangulate a specified region along a 2d plane. The region i wish to tringualte is specified by x and y cooridantes and the lines joining each of these points. However when I use delaunyTriangulation it triangulates the entire region, including the parts I wish to leave out. I have inserted an image below.
Is there anyway to specify the boundary or region of which I would like to triangulate or remove the large unwated trinagles from the triangulation?


If you have boundaries of your region use inpolygon() to indicate points inside and then triangulation
I already have the points which I have included an image below. What I want is to triangulate the narrow region between the points but not outside as keeps happening
Can you please attach this data?

Sign in to comment.

1 Answer

Answer by KSSV
on 7 Jun 2019
 Accepted Answer

Read about delaunayTriangulation , you can provide edge constraints. On providing these constraints; you can avoid such triangles.
DT = delaunayTriangulation(x,y,C)


I have arranged the points Point.txt in an order and run delaunayTriangulation. I am attaching the data and code here.
data = importdata('data.txt') ;
x = data(:,1) ; y = data(:,2) ;
p = (1:length(x))' ;
C = [p(1:end-1) p(2:end)] ;
dt = delaunayTriangulation(x,y,C) ;
xnew = dt.Points(:,1) ; ynew = dt.Points(:,2) ;
isInside = isInterior(dt) ; % Find triangles inside the constrained edges
tri = dt(isInside, :); % Get end point indices of the inner triangles
KSSV, how did you order those points? (Manually?)
I used another software which my colleague uses...:)

Sign in to comment.