[vtkusers] polygon fill / PointInPolygon
Karthik Krishnan
karthik.krishnan at kitware.com
Tue Dec 16 04:11:13 EST 2008
chensiqi wrote:
>
> Hi, VTKers
>
> I wonder if there is any Polygon fill algorithm implemented in
> VTKPolygon class?
>
> If not, maybe Loop through all the points using PointInPolygon is the
> only way I can think of.
Yes, at present the only way in VTK.
>
> Is that " n " in the parameter list of PointInpolygon the normal
> direction? How to estimate it?
Yes it is.
vtkPolygon::ComputeNormal should do the job for you.
The method works by firing rays and checking the number of times a ray
drawn through the line intersects the polygon. Even times implies
outside, odd times => inside. The normal is needed to get the direction
the rays are fired in (they are perpendicular to the normal). The class
could have computed the normal for you, but it is left to the user for
efficiency, since its likely that you will call the methods several
times and wouldn't want to recompute the polygon normal each time.
> int vtkPolygon::*PointInPolygon* (double x[3], int numPts, double
> *pts, double bounds[6], double *n)
>
> Thanks for your help.
>
> Siqi
>
>
>
> ------------------------------------------------------------------------
> 更多热辣资讯尽在新版MSN首页! 立刻访问! <http://cn.msn.com/>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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: 518 371 3971 x119
Fax: 518 371 3971
More information about the vtkusers
mailing list