[vtkusers] problem with normal calculation for output of linear extrusion filter

Nicolas nicolasvtk3 at gmail.com
Fri Jun 10 05:49:43 EDT 2016


Hi,
I am having some troubles with the normal computation of an object.
I am using vtk 7.0.0 and C++ code.

More precisely, the list of operation I am doing from an stl input  is:
1) reading the STL file with vtkSTLReader;
2) computing the normals with vtkPolyDataNormals;
3) applying a vtkThreshold filter on cell which have a z normal component
lower than a given value;
4) applying a vtkConnectivityFilter to put together the regions which are
connected;
5) for each of such regions, applying a linear extrusion with
vtkLinearExtrusionFilter

   vtkSmartPointer<vtkLinearExtrusionFilter> extrude =
vtkSmartPointer<vtkLinearExtrusionFilter>::New();
   extrude->SetInputData(geometryFilterInn->GetOutput());
   extrude->SetVector(0, 0, -1);
   extrude->CappingOn();
   extrude->SetScaleFactor(extrusionLength);
   extrude->Update();

   being geometryFilterInn the output of point 4).

6) exporting the output of linear extrusion filter to stl files with
vtkSTLWriter.

You can find two files generated in this way here
https://app.box.com/s/wkiougfwwxga6vc4rmtyjz25fm1eu9du
https://app.box.com/s/lvzcu3uvk363ycddcsyd838yccyt2sqq

If I calculate the cell normals for such object, I obtain some wrong
results (with Paraview 5.0.1 version as well), especially for cells which
are connected to the rest of cells only by a vertex and for cells which
define a "hole" inside the connected region (for instance, an empty
parallelepiped). At present the code I use to compute the normals is the
following

       vtkSmartPointer<vtkPolyDataNormals> computeNormals =
vtkSmartPointer<vtkPolyDataNormals>::New();
       computeNormals->SetInputData(polyDataPtr);
       computeNormals->ComputeCellNormalsOn();
       computeNormals->Update();

I've also unsuccessfully tried to play with
computeNormals->ConsistencyOn();
computeNormals->AutoOrientNormalsOn();

So, I wonder:
1) is it possible to compute the normals for objects which have "holes" and
with cells connected to the other cells only by vertex?
2) am I doing something wrong with the linear extrusion filter?

Thank you very much,

Nicolas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160610/9d56e0ad/attachment.html>


More information about the vtkusers mailing list