http://www.mathworks.com/matlabcentral/newsreader/view_thread/328570
MATLAB Central Newsreader  Forcing Delaunay triangulation to have a symmetric behaviour
Feed for thread: Forcing Delaunay triangulation to have a symmetric behaviour
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Wed, 24 Apr 2013 23:10:10 +0000
Forcing Delaunay triangulation to have a symmetric behaviour
http://www.mathworks.com/matlabcentral/newsreader/view_thread/328570#903145
Kenan
Hello all,<br>
<br>
I am using Delaunay triangulation to split polygons into triangles. I work on FEM with a very large code, and one of my "checkpoints" is symmetry (if the data is symmetric, the output has to be symmetric too). However, since I have no control over the Delaunay triangulation, it makes me loose the symmetry.<br>
<br>
I have written a small code that illustrates my problem: we consider two disjoints triangles and a big rectangle that intersects them. We want to triangulate the intersections and subtractions of those triangles with the rectangle:<br>
<br>
"<br>
clear all<br>
close all<br>
warning off % the warning is about duplicate points, not important here<br>
<br>
figure<br>
hold on<br>
<br>
p =[.3 .3<br>
.4 .3<br>
.3 .4<br>
.7 .6<br>
.6 .7<br>
.7 .7]; % coordinates of the points for the triangles<br>
<br>
px = 1/3;<br>
py = 1/3;<br>
lx = 1/3;<br>
ly = 1/3; % size and position of the rectangle<br>
<br>
% rearrange the polygon with clockwiseordered vertices<br>
[x1,y1]=poly2cw([px; px+lx; px+lx; px],[py; py; py+ly; py+ly]); % rectangle<br>
<br>
patch(x1,y1, 1, 'EdgeColor', 'k');<br>
<br>
for i=1:2<br>
<br>
pc = p(3*i2:3*i,:); % current triangle<br>
% rearrange the polygon with clockwiseordered vertices<br>
[x0,y0]=poly2cw(pc(:,1),pc(:,2)); % triangle<br>
<br>
[x2,y2] = polybool('intersection',x1,y1,x0,y0); % intersection<br>
[x3,y3] = polybool('subtraction',x0,y0,x2,y2); % subtraction<br>
<br>
DT = delaunayTriangulation(x3,y3);<br>
<br>
triplot(DT)<br>
<br>
end<br>
"<br>
<br>
As you can see, the Delaunay triangulation does not have the same behaviour in both triangles, hence the loss of symmetry.<br>
<br>
Is there a simple way to recover symmetry?<br>
<br>
Thank you.<br>
<br>
Kenan

Wed, 24 Apr 2013 23:43:09 +0000
Re: Forcing Delaunay triangulation to have a symmetric behaviour
http://www.mathworks.com/matlabcentral/newsreader/view_thread/328570#903148
Bruno Luong
"Kenan" wrote in message <kl9ooi$hcp$1@newscl01ah.mathworks.com>...<br>
<br>
> Is there a simple way to recover symmetry?<br>
> <br>
<br>
mesh the half then flip?<br>
<br>
Or the way people usually do: solve the symmetric problem on the half domain.<br>
<br>
Bruno

Thu, 25 Apr 2013 04:07:07 +0000
Re: Forcing Delaunay triangulation to have a symmetric behaviour
http://www.mathworks.com/matlabcentral/newsreader/view_thread/328570#903156
Kenan
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <kl9qmc$m36$1@newscl01ah.mathworks.com>...<br>
> "Kenan" wrote in message <kl9ooi$hcp$1@newscl01ah.mathworks.com>...<br>
> <br>
> > Is there a simple way to recover symmetry?<br>
> > <br>
> <br>
> mesh the half then flip?<br>
> <br>
> Or the way people usually do: solve the symmetric problem on the half domain.<br>
> <br>
> Bruno<br>
<br>
Thank you for your help Bruno.<br>
Actually, this is only a way to check whether my problem (in the general case not symmetric) is correctly solved. So what you suggested is not what I want.

Thu, 25 Apr 2013 20:52:08 +0000
Re: Forcing Delaunay triangulation to have a symmetric behaviour
http://www.mathworks.com/matlabcentral/newsreader/view_thread/328570#903223
Kenan
See here for other details and images:<br>
<a href="http://stackoverflow.com/questions/16203815/delaunaytriangulationmakesmelosesymmetry">http://stackoverflow.com/questions/16203815/delaunaytriangulationmakesmelosesymmetry</a>

Sun, 05 May 2013 02:44:10 +0000
Re: Forcing Delaunay triangulation to have a symmetric behaviour
http://www.mathworks.com/matlabcentral/newsreader/view_thread/328570#903733
Kenan
I had an 'official' asnwser from the technical support:<br>
<br>
"This is definitely due to sensitivity to small rounding differences.<br>
To see the effect, run the attached, modified script several times and observe that<br>
the results are different every time.<br>
It adds very small random errors(magnitude ~1e12) to the vertices of your polygon defined by x3,y3.<br>
<br>
I can only agree with the stackoverflow answer: <br>
"You have to redesign your points in order to get reliable result which does not depend on such things."<br>
<br>
Basically, you cannot depend on delaunay triangulation preserving this kind of symmetry."