MCPcopy Create free account
hub / github.com/Geant4/geant4 / rotate_in_phi

Method rotate_in_phi

source/visualization/OpenGL/src/G4OpenGLXmRotationCallbacks.cc:135–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135void G4OpenGLXmViewer::rotate_in_phi (XtPointer clientData,
136 XtIntervalId* timer_id)
137{
138 //phi spin stuff here
139 // G4double delta_alpha;
140 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
141
142 if (pView -> rotate_up) {
143 pView->rotateScene(0,-1);
144 } else {
145 pView->rotateScene(0,1);
146 }
147 /*
148 if (pView->fVP.GetLightsMoveWithCamera()) {
149 if (pView -> rotate_up) {
150 delta_alpha = -(pView->fRot_sens);
151 } else {
152 delta_alpha = pView->fRot_sens;
153 }
154 } else {
155 if (pView -> rotate_up) {
156 delta_alpha = pView->fRot_sens;
157 } else {
158 delta_alpha = -(pView->fRot_sens);
159 }
160 }
161
162 delta_alpha *= deg;
163
164 const G4Vector3D& vp = pView->fVP.GetViewpointDirection ().unit ();
165 const G4Vector3D& up = pView->fVP.GetUpVector ().unit ();
166
167 const G4Vector3D& xprime = vp;
168 G4Vector3D yprime = (up.cross(xprime)).unit();
169 G4Vector3D zprime = (xprime.cross(yprime)).unit();
170
171 G4Vector3D new_vp = std::cos(delta_alpha) * xprime + std::sin(delta_alpha) * zprime;
172
173 pView->fVP.SetViewAndLights (new_vp.unit());
174
175 if (pView->fVP.GetLightsMoveWithCamera()) {
176 G4Vector3D new_up = (new_vp.cross(yprime)).unit();
177 pView->fVP.SetUpVector(new_up);
178 }
179
180 */
181 pView->SetView ();
182 pView->ClearView ();
183 pView->DrawView ();
184
185 pView->rotation_timer = XtAppAddTimeOut
186 (pView->app,
187 timer_id == NULL ? 500 : 1,
188 rotate_in_phi,
189 pView);
190}
191
192void G4OpenGLXmViewer::set_rot_sens_callback (Widget w,

Callers

nothing calls this directly

Calls 4

rotateSceneMethod · 0.80
SetViewMethod · 0.45
ClearViewMethod · 0.45
DrawViewMethod · 0.45

Tested by

no test coverage detected