[vtkusers] Trouble getting curvatures from vtkCurvatures

Mark Gooding mark.gooding at gmail.com
Fri Jan 12 06:24:48 EST 2007


Hi all,

I'm trying to get the values from vtkCurvatures for the points in a
vtkPolyData object. The mailing list archive has been very helpful for
me in the development of my code and I think I know what I should be
doing, however I'm not having much sucess.

I've managed to get normal data for the points using
vtkPolyDataNormals using this sort of routine:

vtkFloatArray* myPointNormals =
vtkFloatArray::SafeDownCast(myPolyDataNormals->GetOutput()->GetPointData()->GetNormals());
float* normal=new float[3];
myPointNormals->GetTupleValue(j,normal);

However doing a similar thing for curvatures isn't working:

vtkFloatArray* myPointCurvatures =
vtkFloatArray::SafeDownCast(myCurvatures->GetOutput()->GetPointData()->GetScalars());
float* curvature=new float[1];
myPointCurvatures ->GetTupleValue(j,curvature);

the SafeDownCast is returning a null pointer, which makes me think
that I haven't got vtkCurvatures doing the right thing. However

int crvs = ActiveCurvatures->GetOutput()->GetPointData()->GetScalars()->GetNumberOfTuples();

returns the same number as the number of points in myCleanPolyData. So
something must be there?

The code I am using for vtkCurvatures is below. The output of
myCleanPolyData is also used as the input for vtkPolyDataNormals.

vtkCurvatures* myCurvatures= vtkCurvatures::New();
myCurvatures->SetCurvatureTypeToMean();
myCurvatures->SetInput(myCleanPolyData->GetOutput());
myCurvatures->Update();

Have I missed something? I was wondering if there were any
requirements for the input vtkPolyData that vtkCurvatures requires?

Cheers,

Mark



More information about the vtkusers mailing list