36 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER    45 void G4OpenGLXmViewer::theta_rotation_callback (Widget 
w, 
    49   XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
    50   G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
    52   pView->rotate_right = get_boolean_userData (w);
    54   if (cbs->reason == XmCR_ARM) {
    55     rotate_in_theta (pView, NULL);
    56   } 
else if (cbs->reason == XmCR_DISARM) {
    57     XtRemoveTimeOut (pView->rotation_timer);
    61 void G4OpenGLXmViewer::rotate_in_theta (XtPointer clientData,
    62                       XtIntervalId* timer_id) 
    65   G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
    67   if (pView->rotate_right) {
    68     pView->rotateScene(1,0);
    70     pView->rotateScene(-1,0);
   115   pView->rotation_timer = XtAppAddTimeOut 
   117      timer_id == NULL ? 500 : 1,
   122 void G4OpenGLXmViewer::phi_rotation_callback (Widget w, 
   123                         XtPointer clientData, 
   126   XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
   127   G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
   129   pView->rotate_up = get_boolean_userData (w);
   131   if (cbs->reason == XmCR_ARM) {
   132     rotate_in_phi (pView, NULL);
   133   } 
else if (cbs->reason == XmCR_DISARM) {
   134     XtRemoveTimeOut (pView->rotation_timer);
   138 void G4OpenGLXmViewer::rotate_in_phi (XtPointer clientData,
   139                     XtIntervalId* timer_id)
   143   G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
   145   if (pView -> rotate_up) {
   146     pView->rotateScene(0,-1);
   148     pView->rotateScene(0,1);
   188   pView->rotation_timer = XtAppAddTimeOut 
   190      timer_id == NULL ? 500 : 1,
   195 void G4OpenGLXmViewer::set_rot_sens_callback (Widget w, 
   196                         XtPointer clientData, 
   199   XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
   200   G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
   205          XmNdecimalPoints, &dp,
   210   } 
else if ( dp > 0) {
   212       ten_to_the_dp *= 10.;
   216       (
"G4OpenGLXmViewer::set_rot_sens_callback",
   218        "Bad value returned for dp in set_rot_sens_callback");
   221   pView->fRot_sens = (
G4float)(cbs->value) / ten_to_the_dp;
   224 void G4OpenGLXmViewer::set_rot_subject_callback (Widget w, 
   225                            XtPointer clientData, 
   228   G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
   230   G4int choice = get_int_userData (w);
   235       pView->fVP.SetLightsMoveWithCamera (
true);
   240       pView->fVP.SetLightsMoveWithCamera (
false);
   246     (
"G4OpenGLXmViewer::set_rot_subject_callback",
   248      "Unrecognised choice made in set_rot_subject_callback"); 
   253 void G4OpenGLXmViewer::wobble_callback (Widget w, 
   257   G4OpenGLXmViewer* pView;
   263   pView->original_vp = pView->fVP.GetViewpointDirection();
   264   pView->wobble_timer = XtAppAddTimeOut
   266      (
long unsigned int) (1000. * (1. / pView->wob_sens)),
   267      wobble_timer_callback,
   271 void G4OpenGLXmViewer::wobble_timer_callback (XtPointer clientData,
   274   G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
   275   const G4Vector3D& up = pView->fVP.GetUpVector();
   278   G4Vector3D d_up = 0.1 * (std::sin ((
G4double)pView->frameNo * pi_div_by_ten * 2.)) * up;
   279   G4Vector3D d_third_axis = 0.1 * (std::sin ((
G4double)pView->frameNo * (pi_div_by_ten))) * third_axis;
   281   pView->fVP.SetViewAndLights (pView->original_vp + d_up + d_third_axis);
   287   if (pView->frameNo++ == 20) {
   288     if (pView->wobble_timer) {
   289       XtRemoveTimeOut (pView->wobble_timer);
   291       pView->fVP.SetViewAndLights (pView->original_vp);
   297     pView->wobble_timer = XtAppAddTimeOut
   299        (
long unsigned int) (1000. * (1. / pView->wob_sens)),
   300        wobble_timer_callback,
   305 void G4OpenGLXmViewer::reset_callback (Widget w, 
   310   G4OpenGLXmViewer* pView;
   316   pView->fVP.SetCurrentTargetPoint(
G4Point3D());
   317   pView->fVP.SetZoomFactor(1.0);
   318   pView->fVP.SetDolly(0.0);
   322   pView->zoom_low = 0.1;
   323   pView->zoom_high = 10.0;
 
HepGeom::Point3D< G4double > G4Point3D
 
BasicVector3D< T > cross(const BasicVector3D< T > &v) const
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)