[vtkusers] How to extract area weighted normals from cells?
lynx.abraxas at freenet.de
lynx.abraxas at freenet.de
Thu Dec 17 10:37:03 EST 2009
Hello!
Are the normals from vtkPolyDataNormals normalized?
I need a listing of surface area weighted normals of each cell of a
vtkPolyData mesh (from a smoothed marching cubes mesh).
Iterating now over all cells of this vtkPolyData I wonder how I can get the
associated cell normal and the cell area. I tried as follows but I'm
stuck. vtkCell has no getNormal() nor a getAtrribute("Quality") in which
the area is supposed to be after vtkMeshQuality().
Would it be better to extract all Normals and areas into arrays?
How would I have to calculate the weighted normals then?
##calc cell normal
##output as input but with normals added?
triangleCellNormals= vtk.vtkPolyDataNormals()
triangleCellNormals.SetInput(smoother.GetOutput())
triangleCellNormals.ComputeCellNormalsOn()
triangleCellNormals.ComputePointNormalsOff()
triangleCellNormals.ConsistencyOn()
triangleCellNormals.AutoOrientNormalsOn()
triangleCellNormals.Update()
##calc cell area
##output as input but with areas added?
triangleCellAN= vtk.vtkMeshQuality()
triangleCellAN.SetInput(triangleCellNormals)
triangleCellAN.SetTriangleQualityMeasureToArea()
triangleCellAN.SaveCellQualityOn() ##default
triangleCellAN.Update()
for i in range(0, triangleCellAN.GetNumberOfCells()):
cell= triangleCellAN.GetCell(i);
cell.GetNormals()
"Quality"
Thanks for any help or hints about this.
Lynx
On 17/12/09 09:09:03, David Doria wrote:
> On Thu, Dec 17, 2009 at 2:32 AM, Bryn Lloyd <blloyd at vision.ee.ethz.ch> wrote:
> > Another way to compute the area is via vtkMeshQuality.
> >
> > First pass the mesh through this filter, compute the area for all triangles
> > (SetTriangleQualityMeasureToArea()), and the obtain the values from the
> > vtkCellData in the output.
> >
> > Cheers
> > Bryn
>
> Bryn,
>
> I tried that:
> http://www.vtk.org/Wiki/VTK/Examples/Mesh_Quality
>
> But the values in the "Quality" array are all 0. Any thoughts?
>
> Thanks,
>
> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list