<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi, these are the result<br>t: 0<br>t: 0.42105<br>t: 0.84210<br>t: 1.26316<br>t: 1.68421<br>t: 2.10526<br>t: 2.52632<br>t: 2.94737<br>t: 3.36842<br>t: 3.78947<br>t: 4.21053<br>t: 4.63158<br>t: 5.05263<br>t: 5.47368<br>t: 5.89474<br>t: 6.31579<br>t: 6.73684<br>t: 7.15789<br>t: 7.57895<br>t: 8<br><br>i don't know what's wrong with it. Please help me :(<br><br>--- On <b>Sat, 9/5/09, Bill Lorensen <i>&lt;bill.lorensen@gmail.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Bill Lorensen &lt;bill.lorensen@gmail.com&gt;<br>Subject: Re: [vtkusers] vtkSpline<br>To: "Ho Ngoc Ha" &lt;ha_lennon@yahoo.com&gt;<br>Cc: vtkusers@vtk.org<br>Date: Saturday, September 5, 2009, 7:17 PM<br><br><div class="plainMail">Your code look OK. What is the resulting output of the std::cout &lt;&lt;<br>"t: "
 &lt;&lt; t &lt;&lt; std::endl;<br><br>Bill<br><br>On Sat, Sep 5, 2009 at 1:45 AM, Ho Ngoc Ha&lt;<a ymailto="mailto:ha_lennon@yahoo.com" href="/mc/compose?to=ha_lennon@yahoo.com">ha_lennon@yahoo.com</a>&gt; wrote:<br>&gt; Hi,<br>&gt;<br>&gt; I have a set of points, I just need to find a spline that pass through all<br>&gt; of those points and generate a number of output points.<br>&gt;<br>&gt; Here is what I did<br>&gt;<br>&gt; int numberOfInputPoints = points-&gt;GetNumberOfPoints();<br>&gt;<br>&gt; &nbsp; &nbsp; vtkCardinalSpline* aSplineX;<br>&gt; &nbsp; &nbsp; vtkCardinalSpline* aSplineY;<br>&gt; &nbsp; &nbsp; vtkCardinalSpline* aSplineZ;<br>&gt;<br>&gt; &nbsp; &nbsp; aSplineX = vtkCardinalSpline::New();<br>&gt; &nbsp; &nbsp; aSplineY = vtkCardinalSpline::New();<br>&gt; &nbsp; &nbsp; aSplineZ = vtkCardinalSpline::New();<br>&gt;<br>&gt; &nbsp; &nbsp; for (int i=0; i&lt;numberOfInputPoints; i++)<br>&gt; &nbsp;&nbsp;&nbsp; {<br>&gt; &nbsp;&nbsp;&nbsp;
 &nbsp; double x = points-&gt;GetPoint(i)[0];<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp; double y = points-&gt;GetPoint(i)[1];<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp; double z = points-&gt;GetPoint(i)[2];<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aSplineX-&gt;AddPoint(i, x);<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aSplineY-&gt;AddPoint(i, y);<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aSplineZ-&gt;AddPoint(i, z);<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp; }<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp; vtkPoints* polypoints = vtkPoints::New();<br>&gt;<br>&gt;<br>&gt; &nbsp;&nbsp;&nbsp; int numberOfOutputPoints = 20;<br>&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;double t;<br>&gt; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;for (int i=0; i&lt;numberOfOutputPoints; i++)<br>&gt; &nbsp;&nbsp;&nbsp; {<br>&gt; &nbsp; &nbsp; &nbsp; t<br>&gt; =(double)(numberOfInputPoints-1)/(double)(numberOfOutputPoints-1)*(double)i;<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp; std::cout &lt;&lt; "t: " &lt;&lt; t &lt;&lt;
 std::endl;<br>&gt; &nbsp; &nbsp; &nbsp; polypoints-&gt;InsertNextPoint(aSplineX-&gt;Evaluate(t),<br>&gt; aSplineY-&gt;Evaluate(t),<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;aSplineZ-&gt;Evaluate(t));<br>&gt; &nbsp; &nbsp; }<br>&gt;<br>&gt;<br>&gt; I thought the newly generated points will be stored in polypoints? But when<br>&gt; I checked it, it only contains the first and the last point of my input<br>&gt; points.<br>&gt;<br>&gt; I am new to vtk so please help me. Thank you very much<br>&gt;<br>&gt; _______________________________________________<br>&gt; Powered by www.kitware.com<br>&gt;<br>&gt; Visit other Kitware open-source projects at<br>&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>&gt;<br>&gt; Please keep messages on-topic and check the VTK FAQ at:<br>&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ"
 target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>&gt;<br>&gt; Follow this link to subscribe/unsubscribe:<br>&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>&gt;<br>&gt;<br></div></blockquote></td></tr></table><br>