Download presentation
Presentation is loading. Please wait.
Published byRoxanne Brown Modified over 9 years ago
1
Honours Graphics 2008 Session 3
2
Today’s focus Perspective and orthogonal projection Quaternions Graphics camera
3
Projections Visualizing 3D data on a 2D screen requires projection of the data onto a 2D plane Several projection models exist, with varying qualities We’re interested in orthogonal and perspective projection
4
Perspective projection
5
Perspective projection, cont. Starting from world coordinate space:
6
Increasing focal length and distance of the camera to infinity changes perspective into orthogonal projection
7
Orthogonal projection Flat, 2D projection Used when precise profiles or measurements need to be displayed Special case of perspective projection, when focal length approaches infinity
8
Quaternions Developed by Sir William Rowan Hamilton in 1843 Generally superceded by vectors and matrices, but still very useful in applied mathematics and computer graphics Specifically useful to compute 3D rotations Consists of scalar and “vector” components
9
Quaternions, cont. Defined as an extension to the complex numbers: three components i, j and k all are squareroots of -1, hence Furthermore
10
Quaternions, cont. Finally Quaternion addition and subtraction
11
Quaternions, cont. Magnitude of a quaternion Quaternion multiplication
12
Quaternions, cont. For graphics purposes a unit quaternion is used, which has the property that Unit quaternions represent rotation / orientation
13
Quaternions, cont. Quaternion to rotation matrix conversion
14
Graphics camera Both DirectX and OpenGL expose camera parameters that consist of View position View target Relative view-up direction
15
Camera commands OpenGL void gluLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ ) DirectX D3DXMatrixLookAtLH(mat, eye, center, up); DX9Device.SetTransform(D3DTS_VIEW, mat);
16
Homework Write a camera library that makes use of quaternions. Allow for keyboard and mouse input to control the camera. For next session
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.