[vtkusers] about use vtkPolyDataNormals

David Doria daviddoria+vtk at gmail.com
Wed Nov 25 08:53:04 EST 2009


On Wed, Nov 25, 2009 at 1:29 AM, renlishen <renlishen at gmail.com> wrote:

>
> Hi everyone
> I have a question about vtkpolyDataNormals...
> My data is a point data set
> ----------------------------------------------------------------------
> vtkPoints *trianglePoints = vtkPoints::New() ;
> trianglePoints->InsertPoint( 0, 0, 5, 0 ) ;
> trianglePoints->InsertPoint( 1, 5, 0, 0 ) ;
> trianglePoints->InsertPoint( 2, 0, -5, 0 ) ;
> trianglePoints->InsertPoint( 3, -5, 0, 0 ) ;
> trianglePoints->InsertPoint( 4, 0, 0, 5 ) ;
>
> static vtkIdType pts[6][3]={{0,1,3}, {1,2,3}, {0,4,1}, {1,4,2}, {2,4,3},
> {3,4,0}};
>
> vtkCellArray *polys = vtkCellArray::New();
> for (int i=0; i<5; i++) polys->InsertNextCell(3,pts[i]);
>
> vtkPolyData *triangle = vtkPolyData::New();
> triangle->SetPoints( trianglePoints ) ;
> triangle->SetPolys( polys ) ;
> ----------------------------------------------------------------------
>
> If I don't use vtkPolyDataNormals, I get correct number of points
> but when I use
>        vtkPolyDataNormals *triangleCellNormals = vtkPolyDataNormals::New()
> ;
>             triangleCellNormals->SetInput( triangle ) ;
>        triangleCellNormals->ComputeCellNormalsOff() ;
>        triangleCellNormals->ComputePointNormalsOn() ;
>        triangleCellNormals->ConsistencyOn() ;
>        triangleCellNormals->Update() ;
> I get the wrong number of points....
> does anyone tell me why is it?
>
> thanks for your help~
>
>
Can you send a compilable example? Also, can you explain what goes wrong a
bit more? What are the number of points in the correct and incorrect case?
How are you getting the number of points. These are the things that should
be included in the compilable example so we can take a look and make sure it
works before sending it back to you.

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091125/7bba708c/attachment.htm>


More information about the vtkusers mailing list