[vtkusers] resampling vtkPoints

Bill Lorensen bill.lorensen at gmail.com
Fri Jul 23 07:53:46 EDT 2010


Try printing some more information before the spline filter:

sparse_points->Print(std::cout);
sparse_poly->Print(std::cout);

On Fri, Jul 23, 2010 at 1:25 AM, Prathamesh Kulkarni
<prathameshmkulkarni at gmail.com> wrote:
> Thanks for the direction. I am did the following: (myvtkPoints are points
> representative of a contour line which I want to resample with a given
> density):
>         density = 100;
> vtkSmartPointer<vtkPoints> dense_points;
> vtkSmartPointer<vtkPoints> sparse_points = myvtkPoints
> vtkSmartPointer<vtkKochanekSpline> spline_type =
> vtkSmartPointer<vtkKochanekSpline>::New();
> spline_type->SetDefaultContinuity(0.5);
> vtkSmartPointer<vtkPolyData> sparse_poly =
> vtkSmartPointer<vtkPolyData>::New();
> sparse_poly->SetPoints(sparse_points);
> sparse_poly->Update();
> vtkSmartPointer<vtkSplineFilter> spline_filter =
> vtkSmartPointer<vtkSplineFilter>::New();
> spline_filter->SetSpline(spline_type);
> spline_filter->SetInput(sparse_poly);
> spline_filter->SetSubdivideToSpecified();
> spline_filter->SetNumberOfSubdivisions(density);
> spline_filter->Update();
> vtkSmartPointer<vtkPolyData> dense_poly = spline_filter->GetOutput();
> dense_points = dense_poly->GetPoints(); //FAILS HERE: dense_points is NULL
> int number_of_sparse_points = sparse_points->GetNumberOfPoints();
> int number_of_dense_points = dense_points->GetNumberOfPoints();
> Could someone please tell me if I am doing something conceptually wrong
> here?
> Thanks,
> Prathamesh
> On Thu, Jul 22, 2010 at 12:27 PM, Bill Lorensen <bill.lorensen at gmail.com>
> wrote:
>>
>> Look at this example:
>> http://www.vtk.org/Wiki/VTK/Examples/PolyData/FitSplineToCutterOutput
>> it resamples contour lines using splines.
>>
>>
>> On Thu, Jul 22, 2010 at 12:38 PM, Prathamesh Kulkarni
>> <prathameshmkulkarni at gmail.com> wrote:
>> >
>> > Hello all,
>> >
>> > I have a set of points which represent a contour line. I want to be able
>> > to
>> > resample them to a given density. I have looked at vvtkSheperdMethod
>> > documentation but could not find a method similar SetDensity() for its
>> > source.
>> >
>> > What would be the best way to resample a contour data?
>> >
>> >
>> > Thanks,
>> > Prathamesh
>> >
>> > _______________________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Please keep messages on-topic and check the VTK FAQ at:
>> > http://www.vtk.org/Wiki/VTK_FAQ
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.vtk.org/mailman/listinfo/vtkusers
>> >
>> >
>
>



More information about the vtkusers mailing list