Rank: 260870 based on 0 downloads (last 30 days) and 0 file submitted
photo

William Barnhart

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by William View all
Updated File Comments Rating
03 Apr 2013 MESH2D - Automatic Mesh Generation Generates unstructured triangular meshes for general 2D geometry. Author: Darren Engwirda

One more fix. In quadtree.m, near line 528 (right before %Undo rotation, p=rotate(p,-theta)), add:

% remove duplicate nodes
goodid=find(h~=0);
p=p(goodid,:);
h=h(goodid);
for i=1:length(goodid)
t(t==goodid(i))=i;
end

So that's three places to fix with the comments below:
meshfaces.m, line 203
mytsearch.m, line 69
quadtree.m, line 528 (or thereabouts)

02 Apr 2013 MESH2D - Automatic Mesh Generation Generates unstructured triangular meshes for general 2D geometry. Author: Darren Engwirda

**Correction**

In my tsearch, replace:
i(j) = tsearch(x,y,t,xi(j),yi(j));

with:
for k=1:size(t,1)
temp=inpolygon(xi,yi,x(t(k,:)),y(t(k,:)));
i(temp)=k;
end

Then, no need to worry about delaunay triangulations

02 Apr 2013 MESH2D - Automatic Mesh Generation Generates unstructured triangular meshes for general 2D geometry. Author: Darren Engwirda

Tsearch fix courtesy of Rowena Lohman.
tsearch.m needs to be replaced in two locations. First:

in meshfaces.m, line 203 replace:
i=tsearch(ph(:,1),ph(:,2),th,p(:,1),p(:,2));

with:

for j=1:size(th,1)
temp=inpolygon(p(:,1),p(:,2),ph(th(j,:),1),ph(th(j,:),2));
i(temp)=j;
end

In mytsearch.m line 69, replace:
i(j) = tsearch(x,y,t,xi(j),yi(j));

with

t = DelaunayTri([x y]);
i(j)= pointLocation(t,[xi(j) yi(j)]);

This uses DelaunayTri which is being fazed out, but delaunayTriangulation can be equally used

Contact us