部門 > Geant4 > 可視化

「部門/Geant4/可視化」の編集履歴(バックアップ)一覧に戻る

部門/Geant4/可視化 - (2018/01/29 (月) 19:49:27) のソース

*VRML出力
いろんなvisualization出力形式があるが、VRMLでoutputしてview3dsceneというソフトを使うととても良い。
設置するオブジェクトの色は指定するとして、見る対象の位置やカメラの位置の設定などなくてもよい。
というのも、出力後に自由自在に視点を移動することができる。
ちなみにこのソフト、macでもlinuxでも動く。すごく便利。オヌヌメ。

----
vis

*見る対象の位置の設定
/vis/viewer/set/targetPoint [x] [y] [z] [Unit] 
例: /vis/viewer/set/targetPoint 0 0 0 cm 
というのがある
[[Commands in /vis/viewer/set/>http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/AllResources/Control/UIcommands/_vis_viewer_set_.html]]
ぐぐってもマニュアルが引っかからないのだけどちゃんと載ってた。[[2009年に追加された(?)>http://www.phy.bnl.gov/~bviren/lbne/code/ai/external/build/LCG/geant4.9.3.p01/source/visualization/management/History]]機能のようだからそんな新しくも無いと思うんだけど。

*カメラの位置の設定
/vis/viewer/set/viewpointVector [<x>] [<y>] [<z>]
でやる。[[Commands in /vis/viewer/set/>http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/AllResources/Control/UIcommands/_vis_viewer_set_.html]]
カメラとターゲットの位置関係は次のようになっていて、
[[8.4.  Controlling Visualization from Commands>http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch08s04.html#sect.VisCntCmmd.BscCmrWrk]]
このリンク先のようにターゲットからのヴェクターとして視点を決めるので注意。ちょっと意外な指定の仕方な気もするけど、どうやっても必ずターゲットが見えるのはラクでいい。
/vis/viewer/set/viewpointVector は方向しか設定してないので、/vis/viewer/zoom [整数] で設定? [[Commands in /vis/viewer/>http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/AllResources/Control/UIcommands/_vis_viewer_.html]]


-[[Geant4 Vis Tutorial using the OpenGL Event Display>http://geant4.slac.stanford.edu/Presentations/vis/G4OpenGLTutorial/G4OpenGLTutorial.html]]

*上にする方向の設定
/vis/viewer/set/upThetaPhi [theta] [phi] [unit]
デフォルトは
/vis/viewer/set/upThetaPhi 90 90 deg
z軸方向を上にしたかったらthetaはゼロだと思う。なんでそれがデフォルトじゃないのか不思議だけど。


*古い情報
-[[Commands in /vis/>http://geant4.cern.ch/G4UsersDocuments/UsersGuides/ForApplicationDeveloper/html71/Control/UIcommands/_vis_.html]]
--[[Commands in /vis/viewer/>http://geant4.cern.ch/G4UsersDocuments/UsersGuides/ForApplicationDeveloper/html71/Control/UIcommands/_vis_viewer_.html]]
---[[Commands in /vis/viewer/set/>http://geant4.cern.ch/G4UsersDocuments/UsersGuides/ForApplicationDeveloper/html71/Control/UIcommands/_vis_viewer_set_.html]]
は古い情報っぽい。/vis/viewer/targetPosition が載ってなかったり、/vis/viewer/viewpointVector てのと/vis/viewer/set/viewpointVector てのが両方載ってたりする。ググるとこれが出てきてしまう。