[vtkusers] Re: Intersect Line with vtkContourFilter

Tim Seher seher at ipgp.jussieu.fr
Fri Oct 12 07:38:55 EDT 2007


Hi!

Sorry, for this second post. Just want to give some additional information.

I have been playing around some more and I still cannot see, why probing a 
polydata with a line does not work. All I want to do is to sample a surface 
at a given point xy. Any help highly appreciated! Here is, how far I got:


>        ### data
>         reader = vtk.vtkStructuredPointsReader()
>         reader.SetFileName( infile )
>         reader.Update()
>         dims = reader.GetOutput().GetBounds()
>         
>         ### calculate the surfaces
>         surfaces = vtk.vtkContourFilter()
>         surfaces.SetInput(reader.GetOutput())
>         surfaces.GenerateValues(4,2,5)
>     
>         line = vtk.vtkLineSource()
>         
>         transform = vtk.vtkTransform()
>         transform.Translate([0,0,-2])
>         transform.Scale([100,100,100])
>         transform.RotateY(90)
>         
>         tf = vtk.vtkTransformPolyDataFilter()
>         tf.SetInputConnection(line.GetOutputPort())
>         tf.SetTransform(transform)
>         
>         probe = vtk.vtkProbeFilter()
>         probe.SetInputConnection(tf.GetOutputPort())
>         probe.SetSource(surfaces.GetOutput())

>         xyplot = vtk.vtkXYPlotActor()
>         xyplot.AddInput(probe.GetOutput())
>            
>         ren = vtk.vtkRenderer()   
>         ren.AddActor(xyplot)
>         ren.SetBackground(0.7, 0.7, 0.7)
> 
>         win = vtk.vtkRenderWindow()
>         win.AddRenderer(ren)
>         win.SetSize(800, 600)
>         
>         iren = vtk.vtkRenderWindowInteractor()
>         iren.SetRenderWindow(win)
>         
>         win.Render()
>         iren.Initialize()
>         iren.Start()

Sorry and thanks a lot! Tim



More information about the vtkusers mailing list