Chp5 - 3D Graphics
Chp5 - 3D Graphics
Chp5 - 3D Graphics
3-D Graphics
3-D Geometry
• 3D Cartesian coordinate system
• Direction and magnitude along three axes, with reference to an origin
• Location are defined by x, y, z coordinate
• We can define points, segments, lines rays, curves, polygons (any other planar
geometry) and cubes, cones, spheres, etc. (volume in space)
• Can have multiple origins (frame of reference) and transform coordinates
among them
Rules
• These rules determine orientation of axes and direction of rotations
• Thumb = pos x
• Index up = pos y
• Middle out = pos z
• Most world and objects axes tend to be right handed
• Left hand axes often are used for cameras
• Rotation
• Grasp axis with right hand with thumb oriented in positive direction, fingers will then
curl in direction of positive rotation for that axis.
• Where, sx, sy, sz are scale factors along x, y, and z-axes, respectively.
• Translation Transformation matrix:
• The two-dimensional rotation transformation is in reality a special
case of a three-dimensional rotation about the z-axis.
• We will denote it by [Trz], where, the second subscript z indicates
rotation about the z-axis.
• Similarly, rotation about the x and y-axes are denoted as [Trx], and
[Try], respectively. The transformation matrices are given below.
• Matrix for representing three-dimensional rotations about the Z axis
Matrix for representing three-dimensional rotations about the X axis
}
Projection Transform - Perspective Projection
glutIdleFunc(Spin);
glutMainLoop();
}