⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cone2.tcl

📁 a very goog book
💻 TCL
字号:
## This example shows how to add an observer to a Tcl program. It extends# the Step1/Tcl/Cone.tcl Tcl example (see that example for information on# the basic setup). ## VTK uses a command/observer design pattern. That is, observers watch for# particular events that any vtkObject (or subclass) may invoke on# itself. For example, the vtkRenderer invokes a "StartEvent" as it begins# to render. Here we add an observer that invokes a command when this event# is observed.### First we include the VTK Tcl packages which will make available # all of the vtk commands to Tcl#package require vtk## Here we define our callback#proc myCallback {} {    puts "Starting to render"}## Next we create the pipelinne#vtkConeSource conecone SetHeight 3.0cone SetRadius 1.0cone SetResolution 10vtkPolyDataMapper coneMapperconeMapper SetInput [cone GetOutput]vtkActor coneActorconeActor SetMapper coneMappervtkRenderer ren1 ren1 AddActor coneActorren1 SetBackground 0.1 0.2 0.4# here we setup the callbackren1 AddObserver StartEvent myCallbackvtkRenderWindow renWinrenWin AddRenderer ren1renWin SetSize 300 300## now we loop over 360 degreeees and render the cone each time#for {set i 0} {$i < 360} {incr i} {   after 10   # render the image   renWin Render   # rotate the active camera by one degree   [ren1 GetActiveCamera] Azimuth 1}## Free up any objects we created#vtkCommand DeleteAllObjects## exit the application#exit

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -