[vtkusers] Uneven interpolation from vtkTupleInterpolator?

Mengda Wu wumengda at gmail.com
Mon Sep 7 23:34:26 EDT 2015


That works pretty well. What if I would still want the spline fitting since
I will have actually 3 points to insert into the tupleinterpolator? Can I
parameterize by length?

Thanks,
Mengda

On Mon, Sep 7, 2015 at 10:51 AM, Bill Lorensen <bill.lorensen at gmail.com>
wrote:

> Add
>   pointInterpolator->SetInterpolationTypeToLinear();
> before
>   pointInterpolator->SetNumberOfComponents(3);
>
>
> On Sun, Sep 6, 2015 at 10:32 PM, Mengda Wu <wumengda at gmail.com> wrote:
> > Hello,
> >
> >    I am trying to get an even interpolation between two points. For
> example,
> > the following code:
> >
> >       vtkSmartPointer<vtkTupleInterpolator> pointInterpolator =
> > vtkSmartPointer<vtkTupleInterpolator>::New();
> >     pointInterpolator->SetNumberOfComponents(3);
> >
> >     double coord0[3] = {0.0, 0.0, 0.0};
> >     double coord1[3] = {0.0, 0.0, 1.0};
> >
> >     pointInterpolator->AddTuple(0.0, coord0);
> >     pointInterpolator->AddTuple(1.0, coord1);
> >
> >     double coord[3];
> >     double t;
> >     for(int i=0; i<=3; i++)
> >     {
> >         t = i/3.0;
> >         pointInterpolator->InterpolateTuple(t, coord);
> >         std::cout << t << ": " << coord[0] << ", " << coord[1] << ", " <<
> > coord[2] << std::endl;
> >     }
> >
> >     gives me:
> >     0: 0, 0, 0
> >     0.333333: 0, 0, 0.259259
> >     0.666667: 0, 0, 0.740741
> >     1: 0, 0, 1
> >
> >     while I am expecting
> >     0: 0, 0, 0
> >     0.333333: 0, 0, 0.333333
> >     0.666667: 0, 0, 0.666667
> >     1: 0, 0, 1
> >
> >     How should I do this? What if I have more than two points and I need
> an
> > interpolating spline which gives points at even distribution?
> >
> > Thanks,
> > Mengda
> >
> > _______________________________________________
> > 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
> >
> > Search the list archives at: http://markmail.org/search/?q=vtkusers
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
> >
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150907/320b1c31/attachment.html>


More information about the vtkusers mailing list