From: Hualei on
Hello Damian
I have a question on constrained Delaunay:
There are say 600 vetices and the boundary is only consisted of 300 points, and it comes up this error message saying "??? Error using ==> DelaunayTri
The column-vectors defining the edges have inconsistent dimensions."

Could you give some advice?

Thank you!
-Hualei
"Damian " <damian.sheehy(a)mathworks.com> wrote in message <hhacn4$ddq$1(a)fred.mathworks.com>...
> "Shawn " <sfostner(a)physics.mcgill.ca> wrote in message <hgvv10$pos$1(a)fred.mathworks.com>...
> > Hi all,
> >
> > I'm wrestling with something but simply unfamiliar enough with either the background math or matlab itself to figure it out.
> >
> > I have a dataset of 2D triangular mesh data from an external solver (actually a slice of an asymmetric 3D FEM simulation), which I'm attempting to plot. I don't have a problem griddding and plotting it with say the method below:
> >
> > tx = -100:1:100;
> > ty = -100:1:100;
> > [XI,YI] = meshgrid(tx,ty);
> > ZI = griddata(x,y,Efield,XI,YI,'cubic');
> >
> > What concerns me is that the original mesh itself contains a number of voids, empty regions with no points which define certain objects with fixed boundary conditions. When I grid, of course, it also goes into those regions, so the interpolated values at the boundary are of necessity slightly off (the interior is irrelevant, but the most important information for me lies right near the boundary of the objects, and if that is artificially reduced by averaging with the inside (where its arbitrarily zero), then its a problem.
> >
> > Suggestions, ideas where to start? From what I understand, griddata can't handle convex regions, so if I set up a 2d grid excluding them then it will surely choke. I imagine the problem must be common but I haven't had luck finding the solution as yet.
> >
> > Cheers!
>
> The TriScatteredInterp tool (R2009a and later) was specifically designed to handle this usecase. You first need to create a constrained Delaunay triangulation (DelaunayTri), where the constraints represent the boundary that you wish to respect. You then use the constrained DelaunayTri to create a TriScatteredInterp (interpolant).
> This example desmonstrates how to create a constrained Delaunay triangulation.
> http://www.mathworks.com/products/demos/shipping/matlab/demoDelaunayTri.html#18
>
> If you haven't used TriScatteredInterp before, here's an overview on Loren's Art of MATLAB blog.
> http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/
>
> When you create the constrained Delaunay you could, if you wish, replicate your FE mesh by constraining all edges and not just the edges on the free boundary. Either way, you should create a TriRep (Triangulation Representation) to represent your FE mesh as it can provide you with the Free Boundary edges or all edges which you will need to constrain your triangulation.
>
> Damian