[vtkusers] What the array contains in this case?
David E DeMarle
dave.demarle at kitware.com
Tue Oct 28 08:44:52 EDT 2008
On Tue, Oct 28, 2008 at 7:47 AM, B. C. <butterfly.1688 at yahoo.fr> wrote:
> Hi everyone,
> Please, i need help.
> I have a polydata, i used vtkCurvatures to compute the maximum curavtures. I
> did this:
> vtkCurvatures *curve = vtkCurvatures::New();
> curve->SetInput(myPolyData);
> curve->SetCurvatureTypeToMaximum();
>
You need to call:
curve->Update();
here, to tell the filter to go ahead and run.
> vtkPolyData *newPolyData = vtkPolyData::New();
You don't have to create a new poly data structure above.
Instead, the above line can be:
vtkPolyData *newPolyData;
since you are setting the pointer below to something else.
> newPolyData = curve->GetOutput();
>
> Then, i used a double aray to store the values of the curvatures and i did
> this:
> vtkDoubleArray *myArray =
> vtkDoubleArray::SafeDownCast(objetRes->GetPoints());
>
objectRes should be newPolyData above. And you are getting the spatial
coordinates, not the data values. Instead you need call:
vtkDoubleArray *myArray =
newPolyData->GetPointData()->GetArray("Mean_Curvature");
The difference is that you are getting a point associated array call
Mean_Curvature.
> To access to the curves values stored in the array, i used this:
> double curveValue;
> vtkIdType nPoints = myArray->GetNumberOfTuples();
> for (vtkIdType i=0; i<nPoints; i++)
> curveValue = myArray->GetValue(i);
>
> Can you tell me if what i did is right?
> - 'newPolyData' is it 'myPolyData' with maximum curvatures?
> - What the array 'myArray' really contanis?
> - To access to the curev values, is is right to use the finction
> 'GetValue(i)'?
>
> Thank you
>
>
Read the VTK Users guide chapter 11 to learn the layout of vtk's data
structures. Also, pease read some of the Examples that come with code
to get a feel for how to use and manipulate filters and finally read
the vtkCurvatures.cxx class to see exactly what it does.
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
cheers,
--
David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109
More information about the vtkusers
mailing list