[vtkusers] How to know if a point is inside a PolyData?
dgobbi at irus.rri.ca
Mon Sep 10 11:07:53 EDT 2001
I recently added a InsideOrOutside() method to vtkOBBTree that uses
a method similar to the one that Will described. It keeps track of
the normals of the surfaces that the ray passes through to make it
fairly robust (though not perfect), and uses the OBB tree to make it
efficient. You will need a VTK nightly from July 6 or later.
On Mon, 10 Sep 2001, Will Schroeder wrote:
> Hi Carlos-
> >I have a PolyData that is a closed surface. I would know how to get points
> >inside this closed surface randomly. I don't know if there is an easy
> >method in VTK.
> The simple answer is that you can cast rays from the point in a "random"
> direction. Count the intersections. An odd number of intersections means
> the point is inside, even means the point is outside.
> This approach works most of the time. However, due to Murphy's law the rays
> will periodically hit an "edge" or "vertex" of the polydata, in which case
> the counting scheme fails. One approach is to shoot more than one ray in
> different directions and to make sure they both agree, a statistical-based
> Look at vtkPolygon::PointInPolygon. It does something similar to what I am
> describing, only in 2D.
> William J. Schroeder, Ph.D
> Kitware, Inc.
> 469 Clifton Corporate Parkway
> Clifton Park, NY 12065
> will.schroeder at kitware.com
> 1-518-371-3971 x102
> 1-518-371-3971 (fax)
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
More information about the vtkusers