From: Bruno Luong on
"Joe Nunes" <vazdepaivanunes(a)gmail.com> wrote in message <hejhig$ecg$1(a)fred.mathworks.com>...
> Hello,
>
> I have a matrix of points, and a simple patch of triangles. I have the indices of those triangles and the coordenates of the vertices. I need to find in which of the triangle, is each point.
>
> p is the matrix with the points
> tri are the indices of the triangles in the form [12 13 14, 21 2 3, etc]
> face_triangulos are the coordinates of the points which formed the triangles
>
> I am assinging for each point the form [x y z T], where T is the triangle in which the point is contained. z is always zero ..

Take a look at function TSEARCH or method DelaunayTri.pointLocation

Bruno
From: Joe Nunes on
"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hejumg$17j$1(a)fred.mathworks.com>...
> "Joe Nunes" <vazdepaivanunes(a)gmail.com> wrote in message <hejhig$ecg$1(a)fred.mathworks.com>...
> > Hello,
> >
> > I have a matrix of points, and a simple patch of triangles. I have the indices of those triangles and the coordenates of the vertices. I need to find in which of the triangle, is each point.
> >
> > p is the matrix with the points
> > tri are the indices of the triangles in the form [12 13 14, 21 2 3, etc]
> > face_triangulos are the coordinates of the points which formed the triangles
> >
> > I am assinging for each point the form [x y z T], where T is the triangle in which the point is contained. z is always zero ..
>
> Take a look at function TSEARCH or method DelaunayTri.pointLocation
>
> Bruno

Thank you all for your replies. I'll go have a look at those issues.

Regards
From: Joe Nunes on
"Joe Nunes" <vazdepaivanunes(a)gmail.com> wrote in message <hek06n$400$1(a)fred.mathworks.com>...
> "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hejumg$17j$1(a)fred.mathworks.com>...
> > "Joe Nunes" <vazdepaivanunes(a)gmail.com> wrote in message <hejhig$ecg$1(a)fred.mathworks.com>...
> > > Hello,
> > >
> > > I have a matrix of points, and a simple patch of triangles. I have the indices of those triangles and the coordenates of the vertices. I need to find in which of the triangle, is each point.
> > >
> > > p is the matrix with the points
> > > tri are the indices of the triangles in the form [12 13 14, 21 2 3, etc]
> > > face_triangulos are the coordinates of the points which formed the triangles
> > >
> > > I am assinging for each point the form [x y z T], where T is the triangle in which the point is contained. z is always zero ..
> >
> > Take a look at function TSEARCH or method DelaunayTri.pointLocation
> >
> > Bruno
>
> Thank you all for your replies. I'll go have a look at those issues.
>
> Regards

It works fine with inpolygon.

v1 = [face_triangulos(tri(I,1),1) face_triangulos(tri(I,1),2)];
v2 = [face_triangulos(tri(I,2),1) face_triangulos(tri(I,2),2)];
v3 = [face_triangulos(tri(I,3),1) face_triangulos(tri(I,3),2)];

VX = [v1(1) v2(1) v3(1)]';
VY = [v1(2) v2(2) v3(2)]';

if(inpolygon(p(J,1), p(J,2), VX, VY) == [1] )

thank you!
regards