UpdateCamera for fly-through

Jan Kraak J.Kraak at rc.rug.nl
Mon May 22 07:56:12 EDT 2000


Hi vtk-users,

The following tcl-script (vtk 3.1.2)  is part of a larger script to fly-
through a polydataset. I have carefully selected the camera position 
and Roll, Yaw and Pitch values. In addition i put a light in the 
camera postion.

My problem is that I do NOT see the dataset displayed from the 
specified camera position. ONLY if i click one the mouse buttons, 
the dataset is displayed in (nearly) the right way.

In order to see the correct view i guessed that the UpdateCamera 
(without s!!) method of vtkRenderer might be of help. However 
UpdateCamera is not available in tcl, only in c++. 


Any advise to get the right view is appreciated. Thanks in advance.

Jan Kraak



catch {load vtktcl}
if { [catch {set VTK_TCL $env(VTK_TCL)}] != 0} { set VTK_TCL 
"../../examplesTcl" }

source $VTK_TCL/vtkInt.tcl
source $VTK_TCL/colors.tcl


vtkRenderer ren1
vtkRenderWindow renWin
  renWin AddRenderer ren1
vtkRenderWindowInteractor iren
  iren SetRenderWindow renWin

vtkPolyDataReader reader
# keel2.vtk is not supplied
    reader SetFileName keel2.vtk
    reader Update

vtkPolyDataMapper isoMapper
    isoMapper SetInput [reader GetOutput]
    isoMapper ScalarVisibilityOff

vtkActor isoActor
    isoActor SetMapper isoMapper
    eval [isoActor GetProperty] SetColor $antique_white

# assign our actor to the renderer
    ren1 AddActor isoActor

vtkLight aLight
    aLight PositionalOn
    aLight SetConeAngle 60
    ren1 AddLight aLight

    [ren1 GetActiveCamera] SetPosition 260 353 345
    [ren1 GetActiveCamera] SetViewAngle 90 
    [ren1 GetActiveCamera] Roll 0
    [ren1 GetActiveCamera] Yaw 0
    [ren1 GetActiveCamera] Pitch 8


    eval aLight SetFocalPoint [[ren1 GetActiveCamera] GetFocalPoint]
    eval aLight SetPosition [[ren1 GetActiveCamera] GetPosition]


# render the image
    ren1 SetBackground 1 1 1
    renWin SetSize 500 500
    iren Initialize

wm withdraw .

-------------------------------------------------
drs. Jan Kraak
Computing Center University of Groningen
Post Box 800, 9700 AV Groningen, The Netherlands
tel: +31 50 363 3389
fax: +31 50 363 3406
email: J.Kraak at rc.rug.nl
---------------------------------------------
--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list