<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 14px; line-height: 16px; ">Hi,<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">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; outline-width: initial; outline-color: initial; ">of those points and generate a number of output points.<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">Here is what I did<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br
style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">int numberOfInputPoints = points->GetNumberOfPoints();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> <br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> vtkCardinalSpline* aSplineX;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> vtkCardinalSpline* aSplineY;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> vtkCardinalSpline* aSplineZ; <br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> aSplineX =
vtkCardinalSpline::New();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> aSplineY = vtkCardinalSpline::New();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> aSplineZ = vtkCardinalSpline::New();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> for (int i=0; i<numberOfInputPoints; i++) <br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> {<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> double x = points->GetPoint(i)[0];<br style="line-height: 1.2em; outline-style: none; outline-width: initial;
outline-color: initial; "> double y = points->GetPoint(i)[1];<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> double z = points->GetPoint(i)[2];<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> aSplineX->AddPoint(i, x);<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> aSplineY->AddPoint(i, y);<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> aSplineZ->AddPoint(i, z);<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> <br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color:
initial; "> }<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> vtkPoints* polypoints = vtkPoints::New();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> <br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> int numberOfOutputPoints = 20;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> double t;<br style="line-height: 1.2em; outline-style:
none; outline-width: initial; outline-color: initial; "> for (int i=0; i<numberOfOutputPoints; i++) <br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> {<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> t<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">=(double)(numberOfInputPoints-1)/(double)(numberOfOutputPoints-1)*(double)i;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> std::cout << "t: " << t << std::endl;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> polypoints->InsertNextPoint(aSplineX->Evaluate(t),<br style="line-height: 1.2em;
outline-style: none; outline-width: initial; outline-color: initial; ">aSplineY->Evaluate(t),<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> aSplineZ->Evaluate(t));<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> }<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">I thought the newly generated points will be stored in polypoints? But when<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">I checked it, it only contains the first and the last
point of my input<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">points.<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">I am new to vtk so please help me. Thank you very much</span></td></tr></table><br>