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

Method SetRotation

source/visualization/OpenGL/src/G4OpenGLWin32Viewer.cc:452–475  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

450
451//////////////////////////////////////////////////////////////////////////////
452void G4OpenGLWin32Viewer::SetRotation(
453 G4int dx
454,G4int dy
455)
456//////////////////////////////////////////////////////////////////////////////
457//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
458{
459 // Simple ad-hoc algorithms (borrowed from G4Qt3DViewer)
460 const G4Vector3D& x_prime = fVP.GetViewpointDirection()
461 .cross(fVP.GetUpVector());
462 const G4Vector3D& y_prime = x_prime.cross(fVP.GetViewpointDirection());
463 const G4double scale = 200; // Roughly pixels per window, empirically chosen
464 G4Vector3D newViewpointDirection = fVP.GetViewpointDirection();
465 newViewpointDirection += dx*x_prime/scale;
466 newViewpointDirection += dy*y_prime/scale;
467 fVP.SetViewpointDirection(newViewpointDirection.unit());
468
469 if (fVP.GetRotationStyle() == G4ViewParameters::freeRotation) {
470 G4Vector3D newUpVector = fVP.GetUpVector();
471 newUpVector += dx*x_prime/scale;
472 newUpVector += dy*y_prime/scale;
473 fVP.SetUpVector(newUpVector.unit());
474 }
475}
476
477//////////////////////////////////////////////////////////////////////////////
478void G4OpenGLWin32Viewer::SetZoom(G4int delta)

Callers 2

WindowProcMethod · 0.45

Calls 4

GetUpVectorMethod · 0.80
unitMethod · 0.80
SetUpVectorMethod · 0.80
crossMethod · 0.45

Tested by

no test coverage detected