Arc Ball
Arc ball 3D transformation
Public Member Functions
ArcBall Class Reference

#include <ArcBall.hpp>

List of all members.

Public Member Functions

 ArcBall (const glm::vec3 &center, glm::float_t radius, const glm::mat4 &screenToTCS=glm::mat4())
void beginDrag (const glm::vec2 &mouseScreenCoords)
void drag (const glm::vec2 &mouseScreenCoords)
glm::mat4 getTransformation () const

Detailed Description

A reimplementation of Ken Shoemake's arcball camera. SCIRun 4's camera system is based off of Ken's code. The Code appears in Graphics Gems 4, III.1. Unless specified otherwise, all calculations and variables stored in this class are relative to the target coordinate system (TCS) for which there is a transformation from screen space to TCS given by the screenToTCS constructor parameter. If the screenToTCS parameter in the constructor is left as the identity matrix then all values are given in screen coordinates. Screen coordinates are (x [-1,1]) and (y [-1,1]) where (0,0) is the center of the screen.


Constructor & Destructor Documentation

ArcBall ( const glm::vec3 &  center,
glm::float_t  radius,
const glm::mat4 &  screenToTCS = glm::mat4() 
)
Parameters:
centerCenter of the arcball in TCS (screen coordinates if screenToTCS = identity). Generally this will always be (0,0,0). But you may move the center in and out of the screen plane to various effect.
radiusRadius in TCS. For screen coordinates, a good default is 0.75.
screenToTCSTransformation from screen coordinates to TCS. center and radius are given in TCS.

Member Function Documentation

void beginDrag ( const glm::vec2 &  mouseScreenCoords)

Initiate an arc ball drag given the mouse click in screen coordinates.

Parameters:
mouseScreenCoordsMouse screen coordinates.
void drag ( const glm::vec2 &  mouseScreenCoords)

Informs the arcball when the mouse has been dragged.

Parameters:
mouseScreenCoordsMouse screen coordinates.
glm::mat4 getTransformation ( ) const

Retrieves the current transformation in TCS. Obtains full transformation of object in question. If the arc ball is being used to control camera rotation, then this will contain all concatenated camera transformations. The current state of the camera is stored in the quaternions mQDown and mQNow. mMatNow is calculated from mQNow.


The documentation for this class was generated from the following files: