[vtkusers] Genarating Multiple Streamlines on 2-D Plane.

Jean M. Favre jfavre at cscs.ch
Tue Feb 10 03:34:37 EST 2004


Tommie Carr wrote:
> Dear All,
> 
> I am trying to generate streamlines on a 2-D plane using vtkStreamLines.
> The Input to the streamline filter is an unstructured grid.
>

I can propose the following Tcl code segment taken from a working 
application which does exactly what you want, using a LineWidget for 
interactive placement of the seed line. Translation to another language 
is left as an exercise for the reader.


vtkRenderWindowInteractor iren

vtkPolyData seeds

vtkLineWidget lineWidget
   lineWidget SetInput [reader GetOutput]  # the 2D unstructured grid
   lineWidget PlaceWidget
   lineWidget GetPolyData seeds
   lineWidget ClampToBoundsOff
   lineWidget SetResolution 20

vtkStreamTracer Stream
	Stream AddInput [reader GetOutput]
	Stream SelectInputVectors {velocity}
	#Stream SetSource seeds

lineWidget SetInteractor iren
lineWidget AddObserver StartInteractionEvent BeginInteraction
lineWidget AddObserver InteractionEvent GenerateStreamlines

proc BeginInteraction {} {
    Stream SetSource seeds
}

proc GenerateStreamlines {} {
     lineWidget GetPolyData seeds
}

-- 
Dr. Jean M. Favre,                            email:favre @ cscs.ch
http://www.cscs.ch/people/Favre.html
CSCS, Swiss Center for Scientific Computing | Tel:  +41 (91) 610.82.40
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82




More information about the vtkusers mailing list