<div class="gmail_quote">On Fri, Jul 22, 2011 at 5:43 AM, Jothy <span dir="ltr">&lt;<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi all,<br>
<br>
I have a vtkPolyData (generated from vtkDiscreteMarchingCubes) and I<br>
need to find out the points inside this 3D polygon. I looked at this<br>
example in wiki<br>
<br>
<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>.<br>
<br>
I tried to calculate the normal like<br>
<br>
vtkSmartPointer&lt;vtkPolygon&gt; polygon =<br>
    vtkSmartPointer&lt;vtkPolygon&gt;::New();<br>
double n[3];<br>
//pd=vtkPolyData (mesh)<br>
  polygon-&gt;ComputeNormal(pd-&gt;GetPoints()-&gt;GetNumberOfPoints(),<br>
          static_cast&lt;double*&gt;(pd-&gt;GetPoints()-&gt;GetData()-&gt;GetVoidPointer(0)),<br>
n);<br>
<br>
but qDebug()&lt;&lt;n;//similar to std::cout<br>
<br>
it prints a hexadecimal number.<br>
<br>
I don&#39;t understand how to do this correctly.<br>
<br>
Also, should I calculate this normal for each point I am testing.<br>
<br>
Thanks<br>
<br>
Jothy<br></blockquote><div><br></div><div>&#39;n&#39; is an array, so the hex number you are seeing is a memory address of the first element of n.</div><div><br></div><div>You should see what you expect with</div><div><br>
</div><div>cout &lt;&lt; n[0] &lt;&lt; &quot; &quot; &lt;&lt; n[1] &lt;&lt; &quot; &quot; &lt;&lt; n[2];</div><div><br></div><div>David </div></div>