[vtkusers] Extracting normals from polydata add points ?
Nicolas Cedilnik
nicolas.cedilnik at inria.fr
Fri Sep 29 07:00:52 EDT 2017
Hello,
I'm wondering if I should file a bug for this or if it's a feature I
don't understand.
I'm computing normals for a triangular mesh and for some reason the new
polydata (with normals) ends up having more points than the original.
I don't really have time to explore this issue right now but if needed I
do it later. Here's a quick illustration with my ipython output:
In [58]: polydata.GetPoints().GetNumberOfPoints()
Out[58]: 11290
In [59]: normals_generator = vtk.vtkPolyDataNormals()
...: normals_generator.SetInputData(polydata)
...: normals_generator.ComputeCellNormalsOff()
...: normals_generator.ComputePointNormalsOn()
...: normals_generator.Update()
...:
...: polydata_with_normals = normals_generator.GetOutput()
...:
In [60]: polydata_with_normals.GetPoints().GetNumberOfPoints()
Out[60]: 11382
So I have 92 new points, the 11290 first ones being equal:
In [74]:
(vtk_to_numpy(polydata_with_normals.GetPoints().GetData())[:11290] ==
vtk_to_numpy(polydata.GetPoints().GetData())).all()
Out[74]: True
I'm using VTK with python3.6 from conda-forge:
$ conda list | grep vtk
vtk 7.1.1 py36_1 conda-forge
Thoughts?
-- Nicolas
More information about the vtkusers
mailing list