<div dir="ltr"><div><div>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?<br><br></div>Thanks,<br></div>Mengda<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 7, 2015 at 10:51 AM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Add<br>
pointInterpolator->SetInterpolationTypeToLinear();<br>
before<br>
pointInterpolator->SetNumberOfComponents(3);<br>
<div><div class="h5"><br>
<br>
On Sun, Sep 6, 2015 at 10:32 PM, Mengda Wu <<a href="mailto:wumengda@gmail.com">wumengda@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
> I am trying to get an even interpolation between two points. For example,<br>
> the following code:<br>
><br>
> vtkSmartPointer<vtkTupleInterpolator> pointInterpolator =<br>
> vtkSmartPointer<vtkTupleInterpolator>::New();<br>
> pointInterpolator->SetNumberOfComponents(3);<br>
><br>
> double coord0[3] = {0.0, 0.0, 0.0};<br>
> double coord1[3] = {0.0, 0.0, 1.0};<br>
><br>
> pointInterpolator->AddTuple(0.0, coord0);<br>
> pointInterpolator->AddTuple(1.0, coord1);<br>
><br>
> double coord[3];<br>
> double t;<br>
> for(int i=0; i<=3; i++)<br>
> {<br>
> t = i/3.0;<br>
> pointInterpolator->InterpolateTuple(t, coord);<br>
> std::cout << t << ": " << coord[0] << ", " << coord[1] << ", " <<<br>
> coord[2] << std::endl;<br>
> }<br>
><br>
> gives me:<br>
> 0: 0, 0, 0<br>
> 0.333333: 0, 0, 0.259259<br>
> 0.666667: 0, 0, 0.740741<br>
> 1: 0, 0, 1<br>
><br>
> while I am expecting<br>
> 0: 0, 0, 0<br>
> 0.333333: 0, 0, 0.333333<br>
> 0.666667: 0, 0, 0.666667<br>
> 1: 0, 0, 1<br>
><br>
> How should I do this? What if I have more than two points and I need an<br>
> interpolating spline which gives points at even distribution?<br>
><br>
> Thanks,<br>
> Mengda<br>
><br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
</font></span></blockquote></div><br></div>