<div dir="ltr">Hello, you can use a vtkParametricFunctionSource to sample the parametric spline and then add the length of the linear segments. You can see how it can be done by inspecting the method vtkSplineWidget::GetSummedLength at source code  vtkSplineWidget.cxx<br><br>double vtkSplineWidget::GetSummedLength()<br>{<br>  vtkPoints* points = this->ParametricFunctionSource->GetOutput()->GetPoints();<br>  int npts = points->GetNumberOfPoints();<br><br>  if ( npts < 2 ) { return 0.0; }<br><br>  double a[3];<br>  double b[3];<br>  double sum = 0.0;<br>  int i = 0;<br>  points->GetPoint(i, a);<br>  int imax = (npts%2 == 0) ? npts-2 : npts-1;<br><br>  while ( i < imax )<br>    {<br>    points->GetPoint(i+1, b);<br>    sum += sqrt(vtkMath::Distance2BetweenPoints(a, b));<br>    i = i + 2;<br>    points->GetPoint(i, a);<br>    sum = sum + sqrt(vtkMath::Distance2BetweenPoints(a, b));<br>    }<br><br>  if ( npts%2 == 0 )<br>    {<br>    points->GetPoint(i+1, b);<br>    sum += sqrt(vtkMath::Distance2BetweenPoints(a, b));<br>    }<br><br>  return sum;<br>}<br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-11-01 5:05 GMT+01:00 just_rookie <span dir="ltr"><<a href="mailto:925345468@qq.com" target="_blank">925345468@qq.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I have used the vtkParametricSpline class to get a spline, and my next step<br>
is to compute the length of the spline, any help? Thank you in advance!<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/how-to-compute-the-length-of-spline-tp5729305.html" target="_blank">http://vtk.1045678.n5.nabble.com/how-to-compute-the-length-of-spline-tp5729305.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<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://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>