<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><bill.lorensen@gmail.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Bill Lorensen <bill.lorensen@gmail.com><br>Subject: Re: [vtkusers] vtkSpline<br>To: "Ho Ngoc Ha" <ha_lennon@yahoo.com><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 <<<br>"t: "
<< t << std::endl;<br><br>Bill<br><br>On Sat, Sep 5, 2009 at 1:45 AM, Ho Ngoc Ha<<a ymailto="mailto:ha_lennon@yahoo.com" href="/mc/compose?to=ha_lennon@yahoo.com">ha_lennon@yahoo.com</a>> wrote:<br>> Hi,<br>><br>> I have a set of points, I just need to find a spline that pass through all<br>> of those points and generate a number of output points.<br>><br>> Here is what I did<br>><br>> int numberOfInputPoints = points->GetNumberOfPoints();<br>><br>> vtkCardinalSpline* aSplineX;<br>> vtkCardinalSpline* aSplineY;<br>> vtkCardinalSpline* aSplineZ;<br>><br>> aSplineX = vtkCardinalSpline::New();<br>> aSplineY = vtkCardinalSpline::New();<br>> aSplineZ = vtkCardinalSpline::New();<br>><br>> for (int i=0; i<numberOfInputPoints; i++)<br>> {<br>>
double x = points->GetPoint(i)[0];<br>> double y = points->GetPoint(i)[1];<br>> double z = points->GetPoint(i)[2];<br>> aSplineX->AddPoint(i, x);<br>> aSplineY->AddPoint(i, y);<br>> aSplineZ->AddPoint(i, z);<br>><br>> }<br>><br>> vtkPoints* polypoints = vtkPoints::New();<br>><br>><br>> int numberOfOutputPoints = 20;<br>><br>> double t;<br>> for (int i=0; i<numberOfOutputPoints; i++)<br>> {<br>> t<br>> =(double)(numberOfInputPoints-1)/(double)(numberOfOutputPoints-1)*(double)i;<br>> std::cout << "t: " << t <<
std::endl;<br>> polypoints->InsertNextPoint(aSplineX->Evaluate(t),<br>> aSplineY->Evaluate(t),<br>> aSplineZ->Evaluate(t));<br>> }<br>><br>><br>> I thought the newly generated points will be stored in polypoints? But when<br>> I checked it, it only contains the first and the last point of my input<br>> points.<br>><br>> I am new to vtk so please help me. Thank you very much<br>><br>> _______________________________________________<br>> Powered by www.kitware.com<br>><br>> Visit other Kitware open-source projects at<br>> <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:<br>> <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>><br></div></blockquote></td></tr></table><br>