Dear Yaroslav, <BR>I am not sure, what do you mean by "but vtkPolyDataNormals calculates the average normal for all normals as well" and where does it say that vtkPolyDataNormals calculates this.<BR> <BR>In the documentation it says: "The algorithm works by determining normals for each polygon and then averaging them at shared points". Is it this what you mean? This would be the way to calculate the normals of a surfaces at its vertices. So with vtkPolyDataNormals you need to set vtkPolyDataNormals->ComputerPointNormalsOn();<BR> <BR>For the Visualization I guess that you could use vtkGlyph3D with ->SetVectorModeToUseNormal()<BR> <BR>Hope that helps,<BR>Bjoern Zehner<BR><BR><BR>----- Ursprüngliche Nachricht -----<BR>Von: Yaroslav Tenzer <krakadil.gena@gmail.com><BR>Datum: Mittwoch, 24. September 2008, 15:32<BR>Betreff: [vtkusers] How to extract the average normal from vtkPolyDataNormals ?<BR>An: vtkusers@vtk.org<BR>Cc: amy.squillacote@kitware.com<BR><BR>
<DIV dir=ltr> <BR><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 14px; FONT-STYLE: normal; BACKGROUND-COLOR: #f5f8f0">> </FONT>Hello Vtk Users,<BR> <BR><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 14px; FONT-STYLE: normal; BACKGROUND-COLOR: #f5f8f0">> </FONT>I have seen a post by Amy in 2005 on how to access the normals of each polygon ... but vtkPolyDataNormals calculates the average normal for all normals as well ... how do I extract the averaged one from the filter ?<BR> <BR><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 14px; FONT-STYLE: normal; BACKGROUND-COLOR: #f5f8f0">> </FONT>Is there any way to show the normals on the screen ?<BR> <BR><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 14px; FONT-STYLE: normal; BACKGROUND-COLOR: #f5f8f0">> </FONT>I have four polygons ... and I want to find the average normal for them ... and show it on the screen ... and I do not want to reinvent the wheel :)<BR> <BR><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 14px; FONT-STYLE: normal; BACKGROUND-COLOR: #f5f8f0">> </FONT>thank you,<BR><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 14px; FONT-STYLE: normal; BACKGROUND-COLOR: #f5f8f0">> </FONT>yaroslav<BR clear=all><BR>
<H1><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 14px; FONT-STYLE: normal; BACKGROUND-COLOR: #f5f8f0">> </FONT>[vtkusers] How should I get the right normal of a polygon defined in vtkCellArray?</H1><B>Amy Squillacote</B> <A href="javascript:main.compose('new','t=vtkusers%40vtk.org&Subject=%5Bvtkusers%5D%20How%20should%20I%20get%20the%20right%20normal%20of%20a%20polygon%0A%09defined%20in%20vtkCellArray%3F&In-Reply-To=BAY109-F32A78622FBED72BAF2794BB88C0%40phx.gbl')">amy.squillacote at kitware.com </A><BR><I><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 14px; FONT-STYLE: normal; BACKGROUND-COLOR: #f5f8f0">> </FONT>Thu Sep 29 08:59:36 EDT 2005</I>
<P>
<UL>
<LI><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 14px; FONT-STYLE: normal; BACKGROUND-COLOR: #f5f8f0">> </FONT>Previous message: <A href="http://www.vtk.org/pipermail/vtkusers/2005-September/081956.html" target=1>[vtkusers] How should I get the right normal of a polygon defined in vtkCellArray? </A>
<LI>Next message: <A href="http://www.vtk.org/pipermail/vtkusers/2005-September/081958.html" target=1>[vtkusers] Is it a VTK bug of vtkDelaunay2D ? </A>
<LI><B>Messages sorted by:</B> <A href="http://www.vtk.org/pipermail/vtkusers/2005-September/date.html#81957" target=1>[ date ]</A> <A href="http://www.vtk.org/pipermail/vtkusers/2005-September/thread.html#81957" target=1>[ thread ]</A> <A href="http://www.vtk.org/pipermail/vtkusers/2005-September/subject.html#81957" target=1>[ subject ]</A> <A href="http://www.vtk.org/pipermail/vtkusers/2005-September/author.html#81957" target=1>[ author ]</A> </LI></LI></LI></UL>
<HR>
<PRE><FONT style="FONT-WEIGHT: normal; FONT-SIZE: 14px; FONT-STYLE: normal; BACKGROUND-COLOR: #f5f8f0">> </FONT>The normals created by this filter are in a float array in CellData, > not in a vtkCellArray (which only provides information about how > points are connected to form each cell). To apply the filter to your > data and then access the normal of each polygon, do the following. > > vtkPolyDataNormals *normals = vtkPolyDataNormals::New(); > normals->SetInput(yourData); > normals->ComputeCellNormalsOn(); > normals->ComputePointNormalsOff(); > normals->Update(); > > vtkFloatArray *normArray = > vtkFloatArray::SafeDownCast(normals->GetOutput()->GetCellData()->GetNormals()); > int i; > > float point[3]; > for (i = 0; i < normArray->GetNumberOfTuples(); i++) > { > point[0] = normArray->GetValue(i, 0); // x-component of normal > point[1] = normArray->GetValue(i, 1); // y-component of normal > point[2] = normArray->GetValue(i, 2); // z-component of normal > > // Do whatever you need to do to write this value to a file here. > } > > - Amy > > </PRE>
<P></P><BR>> _______________________________________________<BR>> This is the private VTK discussion list.<BR>> Please keep messages on-topic. Check the FAQ at: <BR>> http://www.vtk.org/Wiki/VTK_FAQFollow this link to <BR>> subscribe/unsubscribe:http://www.vtk.org/mailman/listinfo/vtkusers<BR><BR>------------------------------------------------------------------------- <BR>Dr. Bjoern Zehner <BR>UFZ Centre for Environmental Research Leipzig-Halle <BR>Permoserstrasse 15 <BR>04318 Leipzig <BR>Germany <BR>http://www.ufz.de/index.php?en=5673 <BR>Tel: ++49 (341) 235 1979 <BR>Fax: ++49 (341) 235 1939<BR><BR><BR></DIV>