<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">May I suggest that it would be helpful to add a section of code that *interrogates* the final "polypoints" and shows us why you think<div>that it includes only the first and last points.</div><div><br></div><div><br><div><div>On Sep 5, 2009, at 11:03 , Ho Ngoc Ha wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><table cellspacing="0" cellpadding="0" border="0" style="position: static; z-index: auto; "><tbody><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><<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>><br>Subject: Re: [vtkusers] vtkSpline<br>To: "Ho Ngoc Ha" <<a href="mailto:ha_lennon@yahoo.com">ha_lennon@yahoo.com</a>><br>Cc: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><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="x-msg://10/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 <a href="http://www.kitware.com">www.kitware.com</a><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></tbody></table><br>
_______________________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">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">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">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div>--</div><div>Kenneth Sloan</div><div><a href="mailto:KennethRSloan@gmail.com">KennethRSloan@gmail.com</a></div><div><br></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br></div></body></html>