Hi,<br><br>If you can enclose your points in a vtkPolyData, you may want to vtkSplineFilter.<br><br>Hope that helps<br><br>Jerome<br><br><div class="gmail_quote">2009/9/5 Ho Ngoc Ha <span dir="ltr">&lt;<a href="mailto:ha_lennon@yahoo.com">ha_lennon@yahoo.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
<span style="font-family: -webkit-monospace; font-size: 14px; line-height: 16px;">Hi,<br style="line-height: 1.2em; outline-style: none;"><br style="line-height: 1.2em; outline-style: none;">I have a set of points, I just need to find a spline that pass through all<br style="line-height: 1.2em; outline-style: none;">
of those points and generate a number of output points.<br style="line-height: 1.2em; outline-style: none;"><br style="line-height: 1.2em; outline-style: none;">Here is what I did<br style="line-height: 1.2em; outline-style: none;">
<br style="line-height: 1.2em; outline-style: none;">int numberOfInputPoints = points-&gt;GetNumberOfPoints();<br style="line-height: 1.2em; outline-style: none;">   <br style="line-height: 1.2em; outline-style: none;">    vtkCardinalSpline* aSplineX;<br style="line-height: 1.2em; outline-style: none;">
    vtkCardinalSpline* aSplineY;<br style="line-height: 1.2em; outline-style: none;">    vtkCardinalSpline* aSplineZ;    <br style="line-height: 1.2em; outline-style: none;"><br style="line-height: 1.2em; outline-style: none;">
    aSplineX =
 vtkCardinalSpline::New();<br style="line-height: 1.2em; outline-style: none;">    aSplineY = vtkCardinalSpline::New();<br style="line-height: 1.2em; outline-style: none;">    aSplineZ = vtkCardinalSpline::New();<br style="line-height: 1.2em; outline-style: none;">
<br style="line-height: 1.2em; outline-style: none;">    for (int i=0; i&lt;numberOfInputPoints; i++) <br style="line-height: 1.2em; outline-style: none;">    {<br style="line-height: 1.2em; outline-style: none;">      double x = points-&gt;GetPoint(i)[0];<br style="line-height: 1.2em; outline-style: none;">
      double y = points-&gt;GetPoint(i)[1];<br style="line-height: 1.2em; outline-style: none;">      double z = points-&gt;GetPoint(i)[2];<br style="line-height: 1.2em; outline-style: none;">          aSplineX-&gt;AddPoint(i, x);<br style="line-height: 1.2em; outline-style: none;">
          aSplineY-&gt;AddPoint(i, y);<br style="line-height: 1.2em; outline-style: none;">          aSplineZ-&gt;AddPoint(i, z);<br style="line-height: 1.2em; outline-style: none;">    <br style="line-height: 1.2em; outline-style: none;">
    }<br style="line-height: 1.2em; outline-style: none;"><br style="line-height: 1.2em; outline-style: none;">    vtkPoints* polypoints = vtkPoints::New();<br style="line-height: 1.2em; outline-style: none;">    <br style="line-height: 1.2em; outline-style: none;">
<br style="line-height: 1.2em; outline-style: none;">    int numberOfOutputPoints = 20;<br style="line-height: 1.2em; outline-style: none;"><br style="line-height: 1.2em; outline-style: none;">       double t;<br style="line-height: 1.2em; outline-style: none;">
       for (int i=0; i&lt;numberOfOutputPoints; i++) <br style="line-height: 1.2em; outline-style: none;">    {<br style="line-height: 1.2em; outline-style: none;">      t<br style="line-height: 1.2em; outline-style: none;">
=(double)(numberOfInputPoints-1)/(double)(numberOfOutputPoints-1)*(double)i;<br style="line-height: 1.2em; outline-style: none;">      std::cout &lt;&lt; &quot;t: &quot; &lt;&lt; t &lt;&lt; std::endl;<br style="line-height: 1.2em; outline-style: none;">
      polypoints-&gt;InsertNextPoint(aSplineX-&gt;Evaluate(t),<br style="line-height: 1.2em; outline-style: none;">aSplineY-&gt;Evaluate(t),<br style="line-height: 1.2em; outline-style: none;">                       aSplineZ-&gt;Evaluate(t));<br style="line-height: 1.2em; outline-style: none;">
    }<br style="line-height: 1.2em; outline-style: none;"><br style="line-height: 1.2em; outline-style: none;"><br style="line-height: 1.2em; outline-style: none;">I thought the newly generated points will be stored in polypoints? But when<br style="line-height: 1.2em; outline-style: none;">
I checked it, it only contains the first and the last
 point of my input<br style="line-height: 1.2em; outline-style: none;">points.<br style="line-height: 1.2em; outline-style: none;"><br style="line-height: 1.2em; outline-style: none;">I am new to vtk so please help me. Thank you very much</span></td>
</tr></tbody></table><br>

      <br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br>