<div dir="ltr">Thank you David,<br><br>I have several questions regarding your answer, I would very appreciate it if you could answer any further information:<br><br>this is my code: <br><br>//the first function calculates normals to a member type <br>
void angleCalc::generateNormals(<div dir="ltr">vtkPolyData *polydata)<br>{<br> m_normalGenerator->SetInput(polydata);<br> m_normalGenerator->ComputePointNormalsOn();<br> m_normalGenerator->ComputeCellNormalsOff();<br>
m_normalGenerator->Update();<br>
}<br><br>//second function returns the normal at a specific idx from the polydata<br>double* angleCalc::getNormal(vtkIdType idx)<br>{ <br> double arr[3];<br> arr[0] = m_normalGenerator->GetOutput()->GetPointData()->GetComponent(idx,0);<br>
arr[1] = m_normalGenerator->GetOutput()->GetPointData()->GetComponent(idx,1);<br> arr[2] = m_normalGenerator->GetOutput()->GetPointData()->GetComponent(idx,2);<br> return arr;<br>}<br><br>questions:<br>
-------------<br>1. why the following window of vtk appears with this massage ?<br> "vtkFieldData::GetComponent was deprecated for vtk 5.2 and will be removed "<br>2. what's the difference between calculating cell/point normals?<br>
<br>3. regarding the vtkXMLPolyDataWriter:<br> - why the .vtp represents in 3d Glyphse arrows in the<u> same direction</u> as the surface and not in the orthogonal plane as supposed to be? (image attached) </div><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div class="h5"> <br></div></div></div></blockquote><div><br>Many Thanks!<br>Best,<br>Hila <br></div>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div class="h5">
<br><div class="gmail_quote">On Mon, Mar 12, 2012 at 4:43 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On Sun, Mar 11, 2012 at 2:10 PM, Hila Hiler <<a href="mailto:hilahiler@gmail.com" target="_blank">hilahiler@gmail.com</a>> wrote:<br>
> Hi David,<br>
><br>
> I'll try to explain again:<br>
><br>
> How I can calculate the normal at a specific point (id) on polydata.<br>
> I'd like to visualize that normal too, so how to write that normal (as an<br>
> arrow)?<br>
><br>
> this is what I use, but it doesn't write the normals:<br>
> void generateNormals(vtkPolyData* polydata)<br>
> {<br>
><br>
> // Generate normals<br>
> vtkSmartPointer<vtkPolyDataNormals> normalGenerator =<br>
> vtkSmartPointer<vtkPolyDataNormals>::New();<br>
> normalGenerator->SetInput(polydata);<br>
><br>
> normalGenerator->ComputePointNormalsOn();<br>
> normalGenerator->ComputeCellNormalsOff();<br>
> normalGenerator->Update();<br>
><br>
> polydata = normalGenerator->GetOutput();<br>
><br>
> vtkPolyDataWriter* writer = vtkPolyDataWriter::New();<br>
> writer->SetInput(polydata);<br>
> writer->SetFileName("normals.vtk");<br>
> writer->Write();<br>
><br>
> }<br>
<br>
</div>You should use vtkXMLPolyDataWriter instead of vtkPolyDataWriter to<br>
write vtp files instead of vtk files. Also, the normals should be<br>
written to the file automatically. You just need to be sure to display<br>
them. If you are using ParaView (or even your own viewer using VTK) to<br>
view the file you can use the Glyph filter to draw arrows at each<br>
point in the direction of the normal at that point.<br>
<span><font color="#888888"><br>
David<br>
</font></span></blockquote></div><br></div></div></div>
</blockquote></div><br></div>