|
libsc 2.8.7.187-a49fd
The SC library provides support for parallel scientific applications.
|
A camera data structure for maintaining the position, orientation and view frustum of the camera. More...

Files | |
| file | sc_camera.h |
| Camera data structure for computer graphic applications. | |
A camera data structure for maintaining the position, orientation and view frustum of the camera.
View Transformation: p is transformed into the right-handed view coordinate system. In this system:
Transformation steps:
The camera rotation is stored as a unit quaternion q = (q_x, q_y, q_z, q_w), where (q_x, q_y, q_z) are the imaginary parts (i, j, k) and q_w is the real part.
To rotate a point p = (p_x, p_y, p_z), treat it as a pure quaternion (p_x i + p_y j + p_z k), and compute the conjugation: p' = q * p * q^{-1}
Explicitly: p' = (q_x i + q_y j + q_z k + q_w) * (p_x i + p_y j + p_z k) * (-q_x i - q_y j - q_z k + q_w) where quaternion multiplication rules apply (i.e., i^2 = j^2 = k^2 = ijk = -1). The camera rotation is defined such that it rotates the world space so that the camera looks along the negative z-axis. It is the inverse of the rotation that would align the default camera orientation with the preferred camera direction.
In summary, the view transformation is:
p_view = q * (p - camera->position) * q^-1
Projection to Normalized Device Coordinates (NDC): After the view transformation, p is projected into normalized device coordinates (NDC):
The NDC space is left-handed, as in OpenGL:
The projection is defined by:
Points closer than the near plane or farther than the far plane are clipped, meaning they are not mapped inside the visible cube [-1, 1]^3.