[vtkusers] polygon fill / PointInPolygon

chensiqi pidanchen at hotmail.com
Tue Dec 16 13:40:26 EST 2008


Hi, Karthik
 
Thanks for the clarification.  Why the "n" has only one vector?  It is a normal direction with respect to which point? 
I dig into the source code and it seems to me that n is the first well-defined normal vector (length != 0) when you consider the three ajacent points.
 
By the way, the result I have when I loop all the points using PointInPolygon returns the whole region in the bounding box as "inside". What possibly goes wrong?
 
Thanks
Siqi
 
> Date: Tue, 16 Dec 2008 04:11:13 -0500> From: karthik.krishnan at kitware.com> To: pidanchen at hotmail.com> CC: vtkusers at vtk.org> Subject: Re: [vtkusers] polygon fill / PointInPolygon> > 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> 
_________________________________________________________________
超炫人气榜给您所有偶像的最新资讯和排名,快来支持自己的偶像!
http://cnweb.search.live.com/xrank/results.aspx?q=%e5%91%a8%e6%9d%b0%e4%bc%a6&FORM=MSNH
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081217/69866d4c/attachment.htm>


More information about the vtkusers mailing list