vtkSplineFilter uses vtkCardinalSpline as a default. Take a look at vtkKochanekSpline as an alternative. That spline has more user controllable parameters for controlling spline tension.<br><br><div class="gmail_quote">On Thu, Jul 12, 2012 at 11:32 AM, Jean-Hugues Royer <span dir="ltr"><<a href="mailto:jhroyer@joher.com" target="_blank">jhroyer@joher.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div bgcolor="#ffffff" text="#000000">
Yes this was a problem in my C# translation, I confirm that it fixes
the issue and I get a perfect equally subdivided spline.<br>
<br>
Thanks !<div><div class="h5"><br>
<br>
On 12/07/2012 16:53, Jerome Velut wrote:
<blockquote type="cite">
<div>Hi,<br>
<br>
Bill, your script solved Jean-Hugues' issue with vtk-5.10 and
vtk-6.0.<br>
Jean-Hugues, could it be a mistake in your c# translation?<br>
<br>
Jerome<br>
<br>
Le 12/07/2012 15:09, Jean-Hugues Royer a écrit :<br>
</div>
<blockquote type="cite">
Hi,<br>
<br>
I converted it to Activiz/C#, I will let Jerome try exactly your
code (since I can't).<br>
<br>
Regards.<br>
<br>
On 12/07/2012 14:49, Bill Lorensen wrote:
<blockquote type="cite">In the example I sent? I happen to be running
VTK6, but there should not have been changes.<br>
<br>
<div class="gmail_quote">On Thu, Jul 12, 2012 at 8:35 AM,
Jean-Hugues Royer <span dir="ltr"><<a href="mailto:jhroyer@joher.com" target="_blank">jhroyer@joher.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#ffffff" text="#000000"> Hi,<br>
<br>
If I do that, the first ~30 points have a distance of 1
and the rest 0.18648.<br>
<br>
Regards.
<div>
<div><br>
<br>
On 12/07/2012 14:12, Bill Lorensen wrote:
<blockquote type="cite">The splines are
parameterized by an approximation to the arc
length. Also, the boundary conditions of the
splines can affect the shape of the spline. Try
this version of the script:
<div><br>
</div>
<div>
<div>#!/usr/bin/python</div>
<div>import vtk</div>
<div><br>
</div>
<div>lineSource = vtk.vtkLineSource( )</div>
<div>lineSource.SetPoint1( 0, 0, 0 )</div>
<div>lineSource.SetPoint2( 95, 0 ,0 )</div>
<div>lineSource.Update( )</div>
<div><br>
</div>
<div>mySpline = vtk.vtkCardinalSpline( )</div>
<div>mySpline.SetLeftConstraint(2)</div>
<div>mySpline.SetLeftValue(0.0)</div>
<div>mySpline.SetRightConstraint(2)</div>
<div>mySpline.SetRightValue(0.0)</div>
<div><br>
</div>
<div>spline = vtk.vtkSplineFilter( )</div>
<div>spline.SetSpline(mySpline)</div>
<div>spline.SetInputConnection(
lineSource.GetOutputPort( ))</div>
<div>spline.SetSubdivideToLength( )</div>
<div>spline.SetLength( 0.18648 )</div>
<div>spline.Update( )</div>
<div><br>
</div>
<div>points = spline.GetOutput().GetPoints()</div>
<div><br>
</div>
<div>meanDist = 0</div>
<div><br>
</div>
<div>for i in range( 1,
points.GetNumberOfPoints() ):</div>
<div> pt = points.GetPoint(i)</div>
<div> ptPrec = points.GetPoint(i-1)</div>
<div> meanDist += pt[0] - ptPrec[0]</div>
<div> print 'pt[',i,'] X: ',pt[0],' | Distance
with previous point:',pt[0] - ptPrec[0]</div>
<div><br>
</div>
<div>print 'Mean distance: ', meanDist /
points.GetNumberOfPoints()</div>
<div>print 'Expected number of points: ',
95./0.18648</div>
<div>print 'Effective number of points: ',
points.GetNumberOfPoints()</div>
<div><br>
</div>
<div><br>
</div>
<br>
<div class="gmail_quote">On Thu, Jul 12, 2012 at
3:06 AM, Jerome Velut <span dir="ltr"><<a href="mailto:jerome.velut@kitware.com" target="_blank">jerome.velut@kitware.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Hi Bill and Jean-Hugues,<br>
<br>
I was able to reproduce the bug for a
straight line with vtk-5.10 python
(script attached). I also get the same
spline from paraview by exposing the
vtkSplineFilter (hopefully!).<br>
<br>
Jerome<br>
<br>
Le 10/07/2012 19:09, Bill Lorensen a
écrit :<br>
</div>
<div>
<div>
<blockquote type="cite">It is always
possible that there is a bug.<br>
<br>
Can you provide a small, compilable
example that illustrates the
problem?<br>
<br>
<div class="gmail_quote">On Tue, Jul
10, 2012 at 10:50 AM, Jean-Hugues
Royer <span dir="ltr"><<a href="mailto:jhroyer@joher.com" target="_blank">jhroyer@joher.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#ffffff" text="#000000"> Hi,<br>
<br>
I also tried vtkSplineFIlter
using SetSubdivideToLength()
and SetLength(distance).<br>
<br>
But the result is that the
points are not equally
distributed.<br>
<br>
When you provide a curve the
beginning and ending points
are not equally distributed
while the center points are.<br>
<br>
When you provide a straight
line no points at all are
equally distributed.<br>
<br>
I get exact same result when
using
vtkSplineFIlter/SetSubdivideToLength/SetLength
and
vtkParametricSpline/SetParametricFunction/SetUResolution.<br>
<br>
May be I'm missing something ?
<div>
<div><br>
<br>
On 10/07/2012 16:21, Bill
Lorensen wrote:
<blockquote type="cite">Look
at vtkSplineFIlter<br>
Here is one use:<br>
<a href="http://vtk.org/Wiki/VTK/Examples/Cxx/PolyData/FitSplineToCutterOutput" target="_blank">http://vtk.org/Wiki/VTK/Examples/Cxx/PolyData/FitSplineToCutterOutput</a><br>
<br>
<br>
<div class="gmail_quote">
On Tue, Jul 10, 2012
at 9:59 AM,
Jean-Hugues Royer <span dir="ltr"><<a href="mailto:jhroyer@joher.com" target="_blank">jhroyer@joher.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Hi,<br>
<br>
I have a curve which
is a vtkPoints
array.<br>
<br>
I would like to
generate another
vtkPoints array
where every
consecutive points
have the same
distance. (basically
divide the curve to
n equals segments)<br>
<br>
I tried to use
vtkParametricSpline/vtkParametricFunctionSource
but I was only able
to change the number
of points to another
value but I didn't
find how to specify
that these new
points should be
equally distributed.<br>
<br>
Any idea ?<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware
open-source projects
at <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: <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>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Unpaid intern in
BillsBasement at noware
dot com<br>
<br>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Unpaid intern in BillsBasement at
noware dot com<br>
<br>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
<br>
<br>
</div>
</div>
<span><font color="#888888">
<pre cols="72">--
Jérôme Velut
R&D Engineer
Kitware SAS
26 rue Louis Guérin
69100 Villeurbanne, France
F: <a href="tel:%2B33%20%280%294.37.45.04.15" value="+33437450415" target="_blank">+33 (0)4.37.45.04.15</a>
<a href="http://www.kitware.fr" target="_blank">http://www.kitware.fr</a> </pre>
</font></span></div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Unpaid intern in BillsBasement at noware dot com<br>
<br>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Unpaid intern in BillsBasement at noware dot com<br>
<br>
</blockquote>
</blockquote>
<br>
<br>
<pre cols="72">--
Jérôme Velut
R&D Engineer
Kitware SAS
26 rue Louis Guérin
69100 Villeurbanne, France
F: <a href="tel:%2B33%20%280%294.37.45.04.15" value="+33437450415" target="_blank">+33 (0)4.37.45.04.15</a>
<a href="http://www.kitware.fr" target="_blank">http://www.kitware.fr</a> </pre>
</blockquote>
</div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br><br>