SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
SciBall Class Reference

#include <SciBall.h>

Public Member Functions

 SciBall (const spire::V3 &center, float radius, const spire::M44 &screenToTCS=spire::M44())
 
virtual ~SciBall ()
 
void beginDrag (const spire::V2 &mouseScreenCoords)
 
void drag (const spire::V2 &mouseScreenCoords)
 
spire::M44 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.

Todo:

Extend this class to include Mouse screen coords -> object space calculations. That way we can rotate around a particular object. May also want to visually represent the sphere when we perform this calculation.

Provide method of setting the default orientation of the object.

Constructor & Destructor Documentation

SciBall ( const spire::V3 &  center,
float  radius,
const spire::M44 &  screenToTCS = spire::M44() 
)
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.
~SciBall ( )
virtual

Member Function Documentation

void beginDrag ( const spire::V2 &  mouseScreenCoords)

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

Parameters
mouseScreenCoordsMouse screen coordinates.
void drag ( const spire::V2 &  mouseScreenCoords)

Informs the arcball when the mouse has been dragged.

Parameters
mouseScreenCoordsMouse screen coordinates.
Todo:
Perform constraints here.
spire::M44 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: