Well, right now I create my vtkParametricSpline object everytime I add a point to it and it seems like a temporary workaround. But this is really bizarre. I am not sure if it is a bug or now...<br><br>So, basically now my addition of points look like this:
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void KochanekSpline::PushPoint(float x, float y)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int pos = m_controlPoints-&gt;InsertNextPoint(x, y, 0.0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (m_controlPoints-&gt;GetNumberOfPoints() &gt; 1)
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_parametricSpline-&gt;Delete();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_parametricSpline = vtkParametricSpline::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkKochanekSpline* xspline = vtkKochanekSpline::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkKochanekSpline* yspline = vtkKochanekSpline::New();
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkKochanekSpline* zspline = vtkKochanekSpline::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_parametricSpline-&gt;SetXSpline(xspline);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_parametricSpline-&gt;SetYSpline(yspline);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_parametricSpline-&gt;SetZSpline(zspline);
<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; xspline-&gt;Delete();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; yspline-&gt;Delete();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; zspline-&gt;Delete();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_parametricSpline-&gt;SetPoints(m_controlPoints);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_splineSource-&gt;SetParametricFunction(m_parametricSpline);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_splineSource-&gt;Update();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>So, I am creating the vtkParametricSpline object again and, of course, this works as expected. However, terribly inefficient and a pain... It seems these classes are not meant to be interactive...&nbsp; I also tried RemoveAllPoints() individually on all the 3 splines but no joy...
<br><br>Anja<br><br><div><span class="gmail_quote">On 13/11/06, <b class="gmail_sendername">Anja Ende</b> &lt;<a href="mailto:anja.ende@googlemail.com">anja.ende@googlemail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>Just a follow up: Another weird problem is that the spline does not show up till the 4th point has been inserted and even after that is passed through the first, second and the fourth points...skipping the second. Of course, when I move the points, the spline looks fine...
<br><br>Anja<div><span class="e" id="q_10ee1d3e21d5d075_1"><br><br><div><span class="gmail_quote">On 13/11/06, <b class="gmail_sendername">Anja Ende</b> &lt;<a href="mailto:anja.ende@googlemail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
anja.ende@googlemail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi everyone,<br><br>I am having a strange problem when visualizing spline data. When I visualize it, my spline data does not pass through the second last point in the control point collection. As I add new points interactively, it keeps updating the spline but it never passes through the second last position!
<br><br>I create the spline as follows:<br><br>m_parametricSpline = vtkParametricSpline::New();<br>m_parametricSpline-&gt;ClosedOff();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>vtkKochanekSpline* xspline = vtkKochanekSpline::New();<br>vtkKochanekSpline* yspline = vtkKochanekSpline::New();
<br>vtkKochanekSpline* zspline = vtkKochanekSpline::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>m_parametricSpline-&gt;SetXSpline(xspline);<br>m_parametricSpline-&gt;SetYSpline(yspline);<br>m_parametricSpline-&gt;SetZSpline(zspline);<br><br>


xspline-&gt;Delete();<br>yspline-&gt;Delete();<br>zspline-&gt;Delete();<br><br>m_splineSource = vtkParametricFunctionSource::New();<br>m_splineSource-&gt;SetUResolution(200);<br>m_splineSource-&gt;SetVResolution(200);<br>


m_controlPoints = vtkPoints::New();<br><br>The code to add the points is as follows:<br>As I add points here, the display is updated and the spline never passes through the second last point.<br><br>void KochanekSpline::PushPoint(float x, float y)
<br>{<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int pos = m_controlPoints-&gt;InsertNextPoint(x, y, 0.0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (m_controlPoints-&gt;GetNumberOfPoints() &gt; 1)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_parametricSpline-&gt;SetPoints(0);<br>


&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_parametricSpline-&gt;SetPoints(m_controlPoints);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_splineSource-&gt;SetParametricFunction(m_parametricSpline);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_splineSource-&gt;Update();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>}<br>


<br>Now here comes the strange part... I have code that the user can interact with the control points and move them around. This is pretty similar to the code above as follows:<br><br>void KochanekSpline::SetPointAtIndex(unsigned index, float x, float y)
<br>{<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (m_controlPoints-&gt;GetNumberOfPoints() &gt; index)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_controlPoints-&gt;SetPoint(index, x, y, 0.0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (m_controlPoints-&gt;GetNumberOfPoints() &gt; 1)
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_parametricSpline-&gt;SetPoints(0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_parametricSpline-&gt;SetPoints(m_controlPoints);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_splineSource-&gt;SetParametricFunction(m_parametricSpline);
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_splineSource-&gt;Update();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>}<br><br>This works as intended! As soon as I click on a point, the spline now passes through all the control points!!<br><br>

However, as you can see it is pretty similar to the function above! I have no idea why this is happening.
<br><br>Any suggestions and help will be greatly appreciated!<br><br>Thanks,<br><span>Anja<br clear="all"><br><br>

</span></blockquote></div><br><br clear="all"><br></span></div>-- <br>Cheers,<br><span class="sg"><br>Anja

</span></blockquote></div><br><br clear="all"><br>-- <br>Cheers,<br><br>Anja