<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
<BR>Hi, Karthik<BR>
<BR>
Thanks for the clarification. Why the "n" has only one vector? It is a normal direction with respect to which point? <BR>
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.<BR>
<BR>
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?<BR>
<BR>
Thanks<BR>
Siqi<BR>
<BR>
<BR>> Date: Tue, 16 Dec 2008 04:11:13 -0500<BR>> From: karthik.krishnan@kitware.com<BR>> To: pidanchen@hotmail.com<BR>> CC: vtkusers@vtk.org<BR>> Subject: Re: [vtkusers] polygon fill / PointInPolygon<BR>> <BR>> chensiqi wrote:<BR>> ><BR>> > Hi, VTKers<BR>> ><BR>> > I wonder if there is any Polygon fill algorithm implemented in<BR>> > VTKPolygon class?<BR>> ><BR>> > If not, maybe Loop through all the points using PointInPolygon is the<BR>> > only way I can think of.<BR>> Yes, at present the only way in VTK.<BR>> ><BR>> > Is that " n " in the parameter list of PointInpolygon the normal<BR>> > direction? How to estimate it?<BR>> Yes it is.<BR>> vtkPolygon::ComputeNormal should do the job for you.<BR>> <BR>> The method works by firing rays and checking the number of times a ray<BR>> drawn through the line intersects the polygon. Even times implies<BR>> outside, odd times => inside. The normal is needed to get the direction<BR>> the rays are fired in (they are perpendicular to the normal). The class<BR>> could have computed the normal for you, but it is left to the user for<BR>> efficiency, since its likely that you will call the methods several<BR>> times and wouldn't want to recompute the polygon normal each time.<BR>> <BR>> > int vtkPolygon::*PointInPolygon* (double x[3], int numPts, double<BR>> > *pts, double bounds[6], double *n)<BR>> ><BR>> > Thanks for your help.<BR>> ><BR>> > Siqi<BR>> ><BR>> ><BR>> ><BR>> > ------------------------------------------------------------------------<BR>> > 更多热辣资讯尽在新版MSN首页! 立刻访问! <http://cn.msn.com/><BR>> > ------------------------------------------------------------------------<BR>> ><BR>> > _______________________________________________<BR>> > This is the private VTK discussion list.<BR>> > Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<BR>> > Follow this link to subscribe/unsubscribe:<BR>> > http://www.vtk.org/mailman/listinfo/vtkusers<BR>> > <BR>> <BR>> -- <BR>> Karthik Krishnan<BR>> R & D Engineer,<BR>> Kitware Inc,<BR>> Ph: 518 371 3971 x119<BR>> Fax: 518 371 3971<BR>> <BR><BR><br /><hr />更多热辣资讯尽在新版MSN首页! <a href='http://cn.msn.com/' target='_new'>立刻访问!</a></body>
</html>