[vtkusers] getting curvature

Jonathan Morra jonmorra at gmail.com
Tue Oct 19 22:42:31 EDT 2010


This doesn't appear to be working for me.  I have vtkPolyData that is the
output of a vtkContourWidget so it only exists in 2 planes.  Here's the code
that I'm currently running

                vtkCurvatures curvatures = new vtk.vtkCurvatures();
                curvatures.SetInput(currentPolyData);
                curvatures.SetCurvatureTypeToGaussian();
                curvatures.Update();
                vtkPolyData curvatureData = curvatures.GetOutput();
                for (int j=0; j<curvatureData.GetNumberOfPoints(); j++) {
                    double curv
= curvatureData.GetPointData().GetArray(0).GetTuple1(j);
                    ...
However, an exception is being thrown because the
curvatureData.GetPointData().GetNumberOfArrays() method is returning 0.  In
your example I'm not sure what the meanCurvature array is.  I don't want to
visualize the curvature data, just get the curvature at each point and
iterate over the values and compare them.  The full goal is to get the point
index for the n points in currentPolyData with the highest curvature.


On Tue, Oct 19, 2010 at 7:25 PM, David Doria <daviddoria at gmail.com> wrote:

> On Tue, Oct 19, 2010 at 10:04 PM, Jonathan Morra <jonmorra at gmail.com>
> wrote:
> > I have a vtkPolyData and I would like to get the curvature at every
> point.
> >  I noticed that there is a vtkCurvatures class.  Here's the code that I
> have
> > written so far
> >                 vtkCurvatures curvatures = new vtk.vtkCurvatures();
> >                 curvatures.SetInput(currentPolyData);
> >                 curvatures.SetCurvatureTypeToGaussian();
> >                 curvatures.Update();
> >                 vtkPolyData curvatureData = curvatures.GetOutput();
> > However, I don't know what to do with the curvatureData vtkPolyData, and
> how
> > to extract the curvature at every point.
> > Any help would be greatly appreciated.
> > Thanks
>
> Does this example help?
>
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/Curvatures
>
> If you look in Graphics/vtkCurvatures.cxx, you will see the names of
> the arrays that you would want to get: "Minimum_Curvature",
> "Maximum_Curvature", etc. And you will see that they are stored in the
> PointData of the PolyData object:
>
>    mesh->GetPointData()->AddArray(meanCurvature);
>    mesh->GetPointData()->SetActiveScalars("Mean_Curvature");
>
> David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101019/7642b156/attachment.htm>


More information about the vtkusers mailing list