[vtkusers] Check if point is inside convex hull
David Doria
daviddoria+vtk at gmail.com
Tue Nov 17 15:01:51 EST 2009
On Tue, Nov 17, 2009 at 2:37 PM, <lynx.abraxas at freenet.de> wrote:
>
> On 17/11/09 12:41:19, David Doria wrote:
> > I broke your example into two parts:
> >
> > http://www.vtk.org/Wiki/Convex_hull
> >
> > http://www.vtk.org/Wiki/Check_if_a_point_is_inside_an_object
> >
> > The convex hull part works fine. However, the "point inside object" part I
> > am having trouble with. It compiles, but it says both points are outside the
> > sphere. Can someone take a look?
>
> Hi David,
>
> I see You're exampling again even with pics, that's great!
> I'm not sure but when I was looking for a function checking if a point is
> inside a closed surface I found vtkSelectEnclosedPoints. However I haven't
> found the time yet to implement the code using it.
> Looking at Your example I would guess that Sphere->FindCell checks if a point
> is inside the cell's polygon (eg lying on the polygon surface). I'm not sure
> about this but that's what FindCell sounds to me. It would explain why both
> points are "outside" since they are not inside a polygon plane.
>
> Thanks,
> Lynx
>
>
I see... so originally Dirk (he is to thank for the images, by the
way!) was testing if a point was inside the convex hull produced by
delaunay3d. As I understand it, this produces tetrahedra - so that's
why the "point inside" test worked because there were actually
volumetric cells in the polydata?
I tried to use vtkSelectEnclosedPoints here -
http://www.vtk.org/Wiki/Check_if_a_point_is_inside_an_object - (take a
look Lynx)
It works (the IsInside function works properly) but I was getting a
segfault probably due to a data type problem when I tried to get the
whole array of 0/1 labels of inside outside. It was actually crashing
on
InsideArray->GetNumberOfTuples()
Does anyone know how to get the length of a vtkDataArray?
Thanks,
David
More information about the vtkusers
mailing list