<div dir="ltr"><div>Dear S<span name="shinpei">hinpei,</span></div><div><span name="shinpei"></span> </div><div><span name="shinpei">I have never used this class/method before, but can it be a matter of definition? In my opinion you have the interior and the boundary defined by the polygon. I can imagine that &quot;PointInPolygon&quot; checks if the point is in the interior, so it excludes points on the boundary. Since your point is on the boundary, it would then be outside of the polygon.</span></div>
<div><span name="shinpei"></span> </div><div><span name="shinpei">Kind regards,</span></div><div><span name="shinpei"></span> </div><div><span name="shinpei">Marco</span></div><div><span name="shinpei"></span> </div></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 10, 2013 at 2:27 AM, shinpei <span dir="ltr">&lt;<a href="mailto:noro_shinpei@web.de" target="_blank">noro_shinpei@web.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I tried the example  PointInPolygon<br>
&lt;<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/PointInPolygon" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/PointInPolygon</a>&gt;   with<br>
the following code:<br>
<br>
int main()<br>
{<br>
    vtkNew(vtkPolygon, polygon);<br>
    polygon-&gt;GetPoints()-&gt;InsertNextPoint(0.0, 0.0, 0.0);<br>
    polygon-&gt;GetPoints()-&gt;InsertNextPoint(0.0, 10.0, 0.0);<br>
    polygon-&gt;GetPoints()-&gt;InsertNextPoint(10.0, 0.0, 0.0);<br>
<br>
    double testIn[3] = {5.0, 0.0, 0.0};<br>
<br>
    double n[3];<br>
    polygon-&gt;ComputeNormal(polygon-&gt;GetPoints()-&gt;GetNumberOfPoints(),<br>
<br>
static_cast&lt;double*&gt;(polygon-&gt;GetPoints()-&gt;GetData()-&gt;GetVoidPointer(0)),<br>
n);<br>
<br>
    double bounds[6];<br>
    polygon-&gt;GetPoints()-&gt;GetBounds(bounds);<br>
<br>
    std::cout &lt;&lt; &quot;testIn in polygon? &quot; &lt;&lt;<br>
<br>
polygon-&gt;PointInPolygon(testIn,polygon-&gt;GetPoints()-&gt;GetNumberOfPoints(),<br>
<br>
static_cast&lt;double*&gt;(polygon-&gt;GetPoints()-&gt;GetData()-&gt;GetVoidPointer(0)),<br>
                                         bounds, n) &lt;&lt; std::endl;<br>
    return EXIT_SUCCESS;<br>
}<br>
<br>
But the result is: The Point (5 0 0) is not in the polygon. This could not<br>
be the right result. The point rests on the edge (0 0 0) - (10 0 0) of the<br>
triangle.<br>
<br>
What is wrong?<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/PointInPolygon-works-strange-tp5721855.html" target="_blank">http://vtk.1045678.n5.nabble.com/PointInPolygon-works-strange-tp5721855.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>