#include <TransformerArcBall.h>
Inheritance diagram for TransformerArcBall:
Public Member Functions | |
TransformerArcBall (int width, int height) | |
Create an TransformerArcBall with the given dimensions. | |
void | reshape (int width, int height) |
Update the TransformerArcBall dimensions. | |
void | start (float x, float y) |
Starts a rotation at the given screen coordinates. | |
const Matrix | end (float x, float y) |
Compute the rotation matrix determined by the start of the rotation (m_rotationVector) and the current screen position. | |
Private Member Functions | |
float | sphereZ (float x, float y) |
Computes the point on the hemisphere corresponding to a point on the screen. | |
Private Attributes | |
float | m_centerX |
The center of the hemisphere on which the rotation is represented. | |
float | m_centerY |
The center of the hemisphere on which the rotation is represented. | |
float | m_radius |
The radius of the hemisphere on which the rotation is represented. | |
Vector | m_rotationVector |
The Vector from the center of the hemisphere to the point on the hemisphere defined by the current rotation. |
|
Computes the point on the hemisphere corresponding to a point on the screen. Since the hemisphere is guaranteed to cover the entire screen, we know that points on the screen will fall somewhere on the sphere. The Z coordinate (the "height" of the point) is computed trivially using Pythagora's theorem. |
|
Update the TransformerArcBall dimensions. The m_centerX and m_centerY variables are setup to be in the middle of the screen (half of width and, respectively, height). The m_radius variable is setup to be the distance from (m_centerX, m_centerY) to the corner of the screen (thereby ensuring that the hemisphere covers the entire surface of the screen). Implements Transformer. |
|
Starts a rotation at the given screen coordinates. Sets up the m_rotationVector to point to the point on the sphere corresponding to the given position (x, y, sphereZ()) Implements Transformer. |
|
Compute the rotation matrix determined by the start of the rotation (m_rotationVector) and the current screen position. The current screen position is represented by the Vector (x, y, sphereZ()). The rotation is computed as follows:
Implements Transformer. |
|
The center of the hemisphere on which the rotation is represented. The center and the m_radius are guaranteed to define a hemisphere which covers the entire window. |
|
The center of the hemisphere on which the rotation is represented. The center and the m_radius are guaranteed to define a hemisphere which covers the entire window. |
|
The radius of the hemisphere on which the rotation is represented. The radius and the (m_centerX, m_centerY) are guaranteed to define a hemisphere which covers the entire window. |