From: Erik Tang on
I'm relatively new to using both these functions and have read online tutorials and demos. My goal is to created a constrained delaunay tesselation which can be used with pointLocation.

I basically have a bay with small islands throughout. When DelaunayTri is used, elements are created within these islands and outside the actual domain I desire. I do not want these elements to be created. If you physically imagine a bay with islands throughout, the elements should represent water only and not exist in the islands or across areas of land.

What I have done is created a constrained DelaunayTri then removed the unwanted elements. I then created a TriRep to be used later. I want to be able to use ONLY the elements in either tri (as defined below) or in tri_tr (as defined below). I do not want the excess elements on land to be used in pointLocation. Both tri and tri_tr are not the correct class to be used in pointLocation.

Is there a way I can convert either of these to a class DelaunayTri? Or is there a way to get around this?

Note: If you use ADCIRC, the variables will mean something more to you

%DEFINE OUTTER BOUNDARY
C_outter=[NBVV(1,1:NVELL(1)-1)' NBVV(1,2:NVELL(1))'; NBDV(1,1:NVDLL-1)' NBDV(1,2:NVDLL)';];

%DEFINE INNER BOUNDARIES
C_inner2=[NBVV(2,1:NVELL(2)-1)' NBVV(2,2:NVELL(2))'; NBVV(2,NVELL(2)), NBVV(2,1)];
C_inner3=[NBVV(3,1:NVELL(3)-1)' NBVV(3,2:NVELL(3))'; NBVV(3,NVELL(3)), NBVV(3,1)];
C_inner4=[NBVV(4,1:NVELL(4)-1)' NBVV(4,2:NVELL(4))'; NBVV(4,NVELL(4)), NBVV(4,1)];
C_inner5=[NBVV(5,1:NVELL(5)-1)' NBVV(5,2:NVELL(5))'; NBVV(5,NVELL(5)), NBVV(5,1)];
C_inner6=[NBVV(6,1:NVELL(6)-1)' NBVV(6,2:NVELL(6))'; NBVV(6,NVELL(6)), NBVV(6,1)];
C_inner7=[NBVV(7,1:NVELL(7)-1)' NBVV(7,2:NVELL(7))'; NBVV(7,NVELL(7)), NBVV(7,1)];
C_inner8=[NBVV(8,1:NVELL(8)-1)' NBVV(8,2:NVELL(8))'; NBVV(8,NVELL(8)), NBVV(8,1)];

C=[C_outter; C_inner2; C_inner3; C_inner4; C_inner5; C_inner6; C_inner7; C_inner8];
dt = DelaunayTri(X, Y, C);
io = dt.inOutStatus();
tri=dt(io,:);
X_dt=dt.X(:,1);
Y_dt=dt.X(:,2);
tri_tr=TriRep(tri,X_dt,Y_dt);

Thank you for all your help!
From: gozer on
"Erik Tang" <etang858(a)gmail.com> wrote in message <hiitto$145$1(a)fred.mathworks.com>...
> I'm relatively new to using both these functions and have read online tutorials and demos. My goal is to created a constrained delaunay tesselation which can be used with pointLocation.
>
> I basically have a bay with small islands throughout. When DelaunayTri is used, elements are created within these islands and outside the actual domain I desire. I do not want these elements to be created. If you physically imagine a bay with islands throughout, the elements should represent water only and not exist in the islands or across areas of land.
>
> What I have done is created a constrained DelaunayTri then removed the unwanted elements. I then created a TriRep to be used later. I want to be able to use ONLY the elements in either tri (as defined below) or in tri_tr (as defined below). I do not want the excess elements on land to be used in pointLocation. Both tri and tri_tr are not the correct class to be used in pointLocation.
>
> Is there a way I can convert either of these to a class DelaunayTri? Or is there a way to get around this?
>
> Note: If you use ADCIRC, the variables will mean something more to you
>
> %DEFINE OUTTER BOUNDARY
> C_outter=[NBVV(1,1:NVELL(1)-1)' NBVV(1,2:NVELL(1))'; NBDV(1,1:NVDLL-1)' NBDV(1,2:NVDLL)';];
>
> %DEFINE INNER BOUNDARIES
> C_inner2=[NBVV(2,1:NVELL(2)-1)' NBVV(2,2:NVELL(2))'; NBVV(2,NVELL(2)), NBVV(2,1)];
> C_inner3=[NBVV(3,1:NVELL(3)-1)' NBVV(3,2:NVELL(3))'; NBVV(3,NVELL(3)), NBVV(3,1)];
> C_inner4=[NBVV(4,1:NVELL(4)-1)' NBVV(4,2:NVELL(4))'; NBVV(4,NVELL(4)), NBVV(4,1)];
> C_inner5=[NBVV(5,1:NVELL(5)-1)' NBVV(5,2:NVELL(5))'; NBVV(5,NVELL(5)), NBVV(5,1)];
> C_inner6=[NBVV(6,1:NVELL(6)-1)' NBVV(6,2:NVELL(6))'; NBVV(6,NVELL(6)), NBVV(6,1)];
> C_inner7=[NBVV(7,1:NVELL(7)-1)' NBVV(7,2:NVELL(7))'; NBVV(7,NVELL(7)), NBVV(7,1)];
> C_inner8=[NBVV(8,1:NVELL(8)-1)' NBVV(8,2:NVELL(8))'; NBVV(8,NVELL(8)), NBVV(8,1)];
>
> C=[C_outter; C_inner2; C_inner3; C_inner4; C_inner5; C_inner6; C_inner7; C_inner8];
> dt = DelaunayTri(X, Y, C);
> io = dt.inOutStatus();
> tri=dt(io,:);
> X_dt=dt.X(:,1);
> Y_dt=dt.X(:,2);
> tri_tr=TriRep(tri,X_dt,Y_dt);
>
> Thank you for all your help!

I am having similar problems with Delaunay functions. I have a matrix of points that I can get output from using 'delaunay' or 'delaunayn' but receive errors about data types when trying to use DelaunayTri or TriRep. Apparently the codes are using different algorithms.
From: Erik Tang on
I'm not sure if you have the exact same problem as me but here is how I solved mine. I used the inOutstatus function which returned an array of 0's and 1's. 1 if the element was in my desired domain and 0 if outside. When I had to determine if an element was desired or not, I had it reference this inOutstatus array.

delaunay is used to get the input for pointLocation. I then reference inOutstatus to see if I should use the element or not...

dt = DelaunayTri(X, Y, C);
io = dt.inOutStatus();
pointLoc=pointLocation(dt,[x(:,1) y(:,1)])
in_out=io(pointLoc)
if in_out==1
'do something"
else
'do something else'
end

Hope this helps

"gozer " <wolfeb(a)timken.com> wrote in message <hjcg80$n5a$1(a)fred.mathworks.com>...
> "Erik Tang" <etang858(a)gmail.com> wrote in message <hiitto$145$1(a)fred.mathworks.com>...
> > I'm relatively new to using both these functions and have read online tutorials and demos. My goal is to created a constrained delaunay tesselation which can be used with pointLocation.
> >
> > I basically have a bay with small islands throughout. When DelaunayTri is used, elements are created within these islands and outside the actual domain I desire. I do not want these elements to be created. If you physically imagine a bay with islands throughout, the elements should represent water only and not exist in the islands or across areas of land.
> >
> > What I have done is created a constrained DelaunayTri then removed the unwanted elements. I then created a TriRep to be used later. I want to be able to use ONLY the elements in either tri (as defined below) or in tri_tr (as defined below). I do not want the excess elements on land to be used in pointLocation. Both tri and tri_tr are not the correct class to be used in pointLocation.
> >
> > Is there a way I can convert either of these to a class DelaunayTri? Or is there a way to get around this?
> >
> > Note: If you use ADCIRC, the variables will mean something more to you
> >
> > %DEFINE OUTTER BOUNDARY
> > C_outter=[NBVV(1,1:NVELL(1)-1)' NBVV(1,2:NVELL(1))'; NBDV(1,1:NVDLL-1)' NBDV(1,2:NVDLL)';];
> >
> > %DEFINE INNER BOUNDARIES
> > C_inner2=[NBVV(2,1:NVELL(2)-1)' NBVV(2,2:NVELL(2))'; NBVV(2,NVELL(2)), NBVV(2,1)];
> > C_inner3=[NBVV(3,1:NVELL(3)-1)' NBVV(3,2:NVELL(3))'; NBVV(3,NVELL(3)), NBVV(3,1)];
> > C_inner4=[NBVV(4,1:NVELL(4)-1)' NBVV(4,2:NVELL(4))'; NBVV(4,NVELL(4)), NBVV(4,1)];
> > C_inner5=[NBVV(5,1:NVELL(5)-1)' NBVV(5,2:NVELL(5))'; NBVV(5,NVELL(5)), NBVV(5,1)];
> > C_inner6=[NBVV(6,1:NVELL(6)-1)' NBVV(6,2:NVELL(6))'; NBVV(6,NVELL(6)), NBVV(6,1)];
> > C_inner7=[NBVV(7,1:NVELL(7)-1)' NBVV(7,2:NVELL(7))'; NBVV(7,NVELL(7)), NBVV(7,1)];
> > C_inner8=[NBVV(8,1:NVELL(8)-1)' NBVV(8,2:NVELL(8))'; NBVV(8,NVELL(8)), NBVV(8,1)];
> >
> > C=[C_outter; C_inner2; C_inner3; C_inner4; C_inner5; C_inner6; C_inner7; C_inner8];
> > dt = DelaunayTri(X, Y, C);
> > io = dt.inOutStatus();
> > tri=dt(io,:);
> > X_dt=dt.X(:,1);
> > Y_dt=dt.X(:,2);
> > tri_tr=TriRep(tri,X_dt,Y_dt);
> >
> > Thank you for all your help!
>
> I am having similar problems with Delaunay functions. I have a matrix of points that I can get output from using 'delaunay' or 'delaunayn' but receive errors about data types when trying to use DelaunayTri or TriRep. Apparently the codes are using different algorithms.
From: gozer on
"Erik Tang" <etang858(a)gmail.com> wrote in message <hiitto$145$1(a)fred.mathworks.com>...
> I'm relatively new to using both these functions and have read online tutorials and demos. My goal is to created a constrained delaunay tesselation which can be used with pointLocation.
>
> I basically have a bay with small islands throughout. When DelaunayTri is used, elements are created within these islands and outside the actual domain I desire. I do not want these elements to be created. If you physically imagine a bay with islands throughout, the elements should represent water only and not exist in the islands or across areas of land.
>
> What I have done is created a constrained DelaunayTri then removed the unwanted elements. I then created a TriRep to be used later. I want to be able to use ONLY the elements in either tri (as defined below) or in tri_tr (as defined below). I do not want the excess elements on land to be used in pointLocation. Both tri and tri_tr are not the correct class to be used in pointLocation.
>
> Is there a way I can convert either of these to a class DelaunayTri? Or is there a way to get around this?
>
> Note: If you use ADCIRC, the variables will mean something more to you
>
> %DEFINE OUTTER BOUNDARY
> C_outter=[NBVV(1,1:NVELL(1)-1)' NBVV(1,2:NVELL(1))'; NBDV(1,1:NVDLL-1)' NBDV(1,2:NVDLL)';];
>
> %DEFINE INNER BOUNDARIES
> C_inner2=[NBVV(2,1:NVELL(2)-1)' NBVV(2,2:NVELL(2))'; NBVV(2,NVELL(2)), NBVV(2,1)];
> C_inner3=[NBVV(3,1:NVELL(3)-1)' NBVV(3,2:NVELL(3))'; NBVV(3,NVELL(3)), NBVV(3,1)];
> C_inner4=[NBVV(4,1:NVELL(4)-1)' NBVV(4,2:NVELL(4))'; NBVV(4,NVELL(4)), NBVV(4,1)];
> C_inner5=[NBVV(5,1:NVELL(5)-1)' NBVV(5,2:NVELL(5))'; NBVV(5,NVELL(5)), NBVV(5,1)];
> C_inner6=[NBVV(6,1:NVELL(6)-1)' NBVV(6,2:NVELL(6))'; NBVV(6,NVELL(6)), NBVV(6,1)];
> C_inner7=[NBVV(7,1:NVELL(7)-1)' NBVV(7,2:NVELL(7))'; NBVV(7,NVELL(7)), NBVV(7,1)];
> C_inner8=[NBVV(8,1:NVELL(8)-1)' NBVV(8,2:NVELL(8))'; NBVV(8,NVELL(8)), NBVV(8,1)];
>
> C=[C_outter; C_inner2; C_inner3; C_inner4; C_inner5; C_inner6; C_inner7; C_inner8];
> dt = DelaunayTri(X, Y, C);
> io = dt.inOutStatus();
> tri=dt(io,:);
> X_dt=dt.X(:,1);
> Y_dt=dt.X(:,2);
> tri_tr=TriRep(tri,X_dt,Y_dt);
>
> Thank you for all your help!

Thanks for the tip but I think I have something more fundamental wrong. I cannot get DelaunayTri(x,y) to execute on my matrix. I just get an error:
"??? Undefined function or method 'DelaunayTri' for input arguments of type 'double'."

Not sure why since it is just a series of x-y coordinates (there are some negative values, so I am wondering if this is the cause). As I said delaunayn(x,y) seems to run fine.

I am trying to write code to eliminate all triangles the exceed a certain area threshold (trying to do a density screen) on the triangulation plot.
From: Steven Lord on

"gozer " <wolfeb(a)timken.com> wrote in message
news:hjmvij$cfq$1(a)fred.mathworks.com...
> "Erik Tang" <etang858(a)gmail.com> wrote in message
> <hiitto$145$1(a)fred.mathworks.com>...

*snip*

> Thanks for the tip but I think I have something more fundamental wrong. I
> cannot get DelaunayTri(x,y) to execute on my matrix. I just get an error:
> "??? Undefined function or method 'DelaunayTri' for input arguments of
> type 'double'."

The DelaunayTri object was introduced in MATLAB 7.8 (R2009a) -- if you are
using an older version of MATLAB you will not be able to use it.

http://www.mathworks.com/access/helpdesk/help/techdoc/rn/bryg9vd-1.html

If you are using release R2009a or later, check what the output of
"which -all DelaunayTri" returns.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ