[vtkusers] region inside closed spline

Karthik Krishnan karthik.krishnan at kitware.com
Tue Jun 24 12:09:32 EDT 2008


You can take two approaches to evaluating the region inside a vtkSpline 
(or for that matter any closed planar polyline). You can get this 
polyline from a vtkSpline using vtkSplineFilter.

1. See vtkPolygon::PointInPolygon

For any given point, this allows you to check if the point is within the 
polygon (in your case polyline). It checks the number of times a ray 
drawn through the line intersects the polygon. Even times implies 
outside, odd times => inside. The actual implementation does this for a 
bunch of rays along different directions, to overcome numerical issues 
that can happen when a ray falls on the intersection of 2 lines etc...

If you used this method, you would evaluate it over every point in your 
image that lay within the bounds of your polyline.


2.Use vtkPolyDataToImageStencil to generate vtkImageStencilData. And 
then using vtkImageStencil to generate the rasterized image See 
Examples/GUI/Tcl/ImageTracerWidget.tcl. this uses OBBTrees for 
intersection tests.




(1) is a much much faster approach to rasterize a planar polyline.



Marie-Gabrielle Vallet wrote:
> Gokhan,
> By vtkSpline, do you mean a curve in a plane ? To triangulate the 
> surface inside a close curve, you should use a vtkPolygon.
> Marie-Gabrielle
>
> > Dear VTK users I am looking for a function which computes the region
> > inside a vtkspline.
> > Is there any vtk method to extract or label the region inside a
> > closed contour?
> >
> > Thank you very much for your help.
> >
> > Gokhan
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   

-- 
--
Karthik Krishnan
R & D Engineer,
Kitware Inc,
Ph: +1 518 3713971 x119
Fax: +1 518 3714573




More information about the vtkusers mailing list