[vtkusers] Curve / Equal Subdivision
Jerome Velut
jerome.velut at kitware.com
Thu Jul 12 03:06:06 EDT 2012
Hi Bill and Jean-Hugues,
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!).
Jerome
Le 10/07/2012 19:09, Bill Lorensen a écrit :
> It is always possible that there is a bug.
>
> Can you provide a small, compilable example that illustrates the problem?
>
> On Tue, Jul 10, 2012 at 10:50 AM, Jean-Hugues Royer <jhroyer at joher.com
> <mailto:jhroyer at joher.com>> wrote:
>
> Hi,
>
> I also tried vtkSplineFIlter using SetSubdivideToLength() and
> SetLength(distance).
>
> But the result is that the points are not equally distributed.
>
> When you provide a curve the beginning and ending points are not
> equally distributed while the center points are.
>
> When you provide a straight line no points at all are equally
> distributed.
>
> I get exact same result when using
> vtkSplineFIlter/SetSubdivideToLength/SetLength and
> vtkParametricSpline/SetParametricFunction/SetUResolution.
>
> May be I'm missing something ?
>
>
> On 10/07/2012 16:21, Bill Lorensen wrote:
>> Look at vtkSplineFIlter
>> Here is one use:
>> http://vtk.org/Wiki/VTK/Examples/Cxx/PolyData/FitSplineToCutterOutput
>>
>>
>> On Tue, Jul 10, 2012 at 9:59 AM, Jean-Hugues Royer
>> <jhroyer at joher.com <mailto:jhroyer at joher.com>> wrote:
>>
>> Hi,
>>
>> I have a curve which is a vtkPoints array.
>>
>> I would like to generate another vtkPoints array where every
>> consecutive points have the same distance. (basically divide
>> the curve to n equals segments)
>>
>> 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.
>>
>> Any idea ?
>>
>> _______________________________________________
>> Powered by www.kitware.com <http://www.kitware.com>
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com
>>
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
--
Jérôme Velut
R&D Engineer
Kitware SAS
26 rue Louis Guérin
69100 Villeurbanne, France
F: +33 (0)4.37.45.04.15
http://www.kitware.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120712/a5fa76b4/attachment.htm>
-------------- next part --------------
import vtk
lineSource = vtk.vtkLineSource( )
lineSource.SetPoint1( 0, 0, 0 )
lineSource.SetPoint2( 95, 0 ,0 )
lineSource.Update( )
spline = vtk.vtkSplineFilter( )
spline.SetInputConnection( lineSource.GetOutputPort( ))
spline.SetSubdivideToLength( )
spline.SetLength( 0.18648 )
spline.Update( )
points = spline.GetOutput().GetPoints()
meanDist = 0
for i in range( 1, points.GetNumberOfPoints() ):
pt = points.GetPoint(i)
ptPrec = points.GetPoint(i-1)
meanDist += pt[0] - ptPrec[0]
print 'pt[',i,'] X: ',pt[0],' | Distance with previous point:',pt[0] - ptPrec[0]
print 'Mean distance: ', meanDist / points.GetNumberOfPoints()
print 'Expected number of points: ', 95./0.18648
print 'Effective number of points: ', points.GetNumberOfPoints()
More information about the vtkusers
mailing list