[vtkusers] Line polygon intersection

Jothybasu Selvaraj jothybasu at gmail.com
Mon Feb 13 09:25:27 EST 2012


Thanks David,

But vtkPolygon::PointInPolygon, I can only define the point of interest, to
check whether it is inside the given polygon or not. I want to define the
starting and end points of the ray and find whether it intersects a 2D
polygon, the ray will pass through the polygon in any 3D angle.

I will try the BSP tree.

Jothy

On Mon, Feb 13, 2012 at 2:10 PM, David Doria <daviddoria at gmail.com> wrote:

> On Mon, Feb 13, 2012 at 9:07 AM, Jothybasu Selvaraj <jothybasu at gmail.com>
> wrote:
> > Hi all,
> >
> > I want to find whether a ray passes through a 2D polygon or not. The 2D
> > polygon will be at any depth and orientation (rotate aboth x,y,&z axes).
> >
> > Can the vtkOBBTree or vtkModifiedBSPTree do this?
> >
> > Thanks
> >
> > --
> > Jothy
>
> Yes, and the vtkModifiedBSPTree is much much faster:
>
>
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/DataStructures/ModifiedBSPTree_IntersectWithLine
>
> If you just need to intersect one polygon (not a whole tree of a
> mesh), you can use
>
> http://www.vtk.org/doc/nightly/html/classvtkPolygon.html#aaa65561067bdaaca9f965fffcc7e7e8b
> directly.
>
> David
>



-- 
Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120213/d8aabc76/attachment.htm>


More information about the vtkusers mailing list