[vtkusers] Uneven interpolation from vtkTupleInterpolator?

Mengda Wu wumengda at gmail.com
Sun Sep 6 22:32:37 EDT 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150906/65567b88/attachment.html>


More information about the vtkusers mailing list