<p dir="ltr">Please post small compilable program that illustrates the issue.</p>
<div class="gmail_quote">On Jun 4, 2015 8:12 AM, "joaoroberto88" <<a href="mailto:joaorobertojr88@gmail.com">joaorobertojr88@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I have a 2D polygon and I'm trying to use the vtkPolygon::PointInPolygon<br>
function as follow:<br>
<br>
bool pointInPolygon(double *point) {<br>
double *dataPointer =<br>
static_cast<double*>(filteredPolygon->GetPoints()->GetData()->GetVoidPointer(0));<br>
int numberOfPoints = filteredPolygon->GetPoints()->GetNumberOfPoints();<br>
double p[3] = { point[0], point[1], point[2] };<br>
double bounds[6];<br>
double normal[3];<br>
<br>
filteredPolygon->ComputeNormal(filteredPolygon->GetPoints(), normal);<br>
filteredPolygon->GetPoints()->GetBounds(bounds);<br>
<br>
return filteredPolygon->PointInPolygon(p, numberOfPoints, dataPointer,<br>
bounds, normal);<br>
}<br>
<br>
It happens that the above function returns true for every point inside the<br>
polygon bounds. I've read in this mailing list that the problem can be<br>
related to the normal. Actually, the normal value is [0, 0, 1] in this piece<br>
of code, so the true return makes sense regarding the space dimension<br>
(ray-castings will never intersect a 2D object on z axis). Then I set<br>
manually normal values such as [1, 0, 0], [0, 1, 0] and [1, 1, 0], but I<br>
still having no luck.<br>
<br>
If you guys can help me, I would like to know what is going wrong on my<br>
implementation.<br>
<br>
Thanks a lot.<br>
<br>
Joao.<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Point-in-Polygon-does-not-return-correct-value-as-expected-tp5732164.html" target="_blank">http://vtk.1045678.n5.nabble.com/Point-in-Polygon-does-not-return-correct-value-as-expected-tp5732164.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>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div>