<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><br><br>Hi, I picked another set of points and here are the results. Thanks a lot!<br><br>t: 0<br>x: 519.751, y: 1513.14, z: 0<br><br>t: 0.473684<br>x: 519.726, y: 1500.95, z: 0<br><br>t: 0.947368<br>x: 519.741, y: 1475.55, z: 0<br><br>t: 1.42105<br>x: 519.87, y: 1452.08, z: 0<br><br>t: 1.89474<br>x: 519.826, y: 1436.93, z: 0<br><br>t: 2.36842<br>x: 519.203, y: 1430.78, z: 0<br><br>t: 2.84211<br>x: 517.644, y: 1413.63, z: 0<br><br>t: 3.31579<br>x: 515.1, y: 1358.18, z: 0<br><br>t: 3.78947<br>x: 514.835, y: 1267.1, z: 0<br><br>t: 4.26316<br>x: 521.848, y: 1162.43, z: 0<br><br>t: 4.73684<br>x: 534.034, y: 1066.13, z: 0<br><br>t: 5.21053<br>x: 543.353, y: 999.33, z: 0<br><br>t: 5.68421<br>x: 548.978, y: 967.812, z: 0<br><br>t: 6.15789<br>x: 558.516, y: 959.351, z: 0<br><br>t:
6.63158<br>x: 572.076, y: 943.877, z: 0<br><br>t: 7.10526<br>x: 577.448, y: 865.487, z: 0<br><br>t: 7.57895<br>x: 568.835, y: 714.475, z: 0<br><br>t: 8.05263<br>x: 556.11, y: 582.674, z: 0<br><br>t: 8.52632<br>x: 548.223, y: 536.911, z: 0<br><br>t: 9<br>x: 545.789, y: 535.286, z: 0<br><br>--- On <b>Sat, 9/5/09, Bill Lorensen <bill.lorensen@gmail.com></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, 11:52 PM<br><br><div class="plainMail">Please print:<br>std::cout << "x: " << aSplineX->Evaluate(t) << ", y: " <<<br>aSplineY->Evaluate(t) << ", z: " << aSplineZ->Evaluate(t)
<<<br>std::endl;<br><br><br>On Sat, Sep 5, 2009 at 12:03 PM, 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, 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 Sat, 9/5/09, Bill Lorensen <<a ymailto="mailto:bill.lorensen@gmail.com" href="/mc/compose?to=bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>> wrote:<br>><br>> From: Bill Lorensen <<a ymailto="mailto:bill.lorensen@gmail.com"
href="/mc/compose?to=bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>><br>> Subject: Re: [vtkusers] vtkSpline<br>> To: "Ho Ngoc Ha" <<a ymailto="mailto:ha_lennon@yahoo.com" href="/mc/compose?to=ha_lennon@yahoo.com">ha_lennon@yahoo.com</a>><br>> Cc: <a ymailto="mailto:vtkusers@vtk.org" href="/mc/compose?to=vtkusers@vtk.org">vtkusers@vtk.org</a><br>> Date: Saturday, September 5, 2009, 7:17 PM<br>><br>> 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>>><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<br>>> 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>><br>><br></div></blockquote></td></tr></table><br>