3 D Coordinate Systems o 3 D computer
- Slides: 34
3 D Coordinate Systems o 3 D computer graphics involves the additional dimension of depth, allowing more realistic representations of 3 D objects in the real world o There are two possible ways of “attaching” the Z-axis, which gives rise to a left-handed or a right-handed system
3 D Transformation o The translation, scaling and rotation transformations used for 2 D can be extended to three dimensions o In 3 D, each transformation is represented by a 4 x 4 matrix o Using homogeneous coordinates it is possible to represent each type of transformation in a matrix form and integrate transformations into one matrix o To apply transformations, simply multiply matrices, also easier in hardware and software implementation o Homogeneous coordinates can represent directions o Homogeneous coordinates also allow for non-affine transformations, e. g. , perspective projection
Homogeneous Coordinates o In 2 D, use three numbers to represent a point o (x, y) = (wx, wy, w) for any constant w 0 o To go backwards, divide by w, (x, y) becomes (x, y, 1) o Transformation can now be done with matrix multiplication
Basic 2 D Transformations o Translation: o Scaling: o Rotation:
Translation and Scalling Matrice o The translation and scaling transformations may be represented in 3 D as follows: Translation matrix Scaling matrix 1 0 0 0 ( 0 1 0 SX 0 0 0 SY 0 0 0 SZ 0 0 0 ( ) ) tr. X tr. Y tr. Z 1 0 0 0 1
Translation original V=(ai + bj +ck) == (a, b, c) translation along y, or V = (0, k, 0)
Scaling Original scale all axes scale Y axis offset from origin
3 D Shearing: The change in each coordinate is a linear combination of all three Transforms a cube into a general parallelepiped
Rotation o In 2 D, rotation is about a point o In 3 D, rotation is about a vector, which can be done through rotations about x, y or z axes o Positive rotations are anti-clockwise, negative rotations are clockwise, when looking down a positive axis towards the origin y y x x x z y z z
Major Axis Rotation Matrices o about X axis o about Y axis o about Z axis Rotations are orthogonal matrices, preserving distances and angles.
Rotation rotation of 45 o about the Z axis offset from origin translation then rotate about Z axis
Rotation Axis o In general rotation vector does not pass through origin
Rotation about an Arbitrary Axis o Rotation about an Arbitrary Axis Basic Idea y T (x 2, y 2, z 2) R (x 1, y 1, z 1) x z R-1 T-1 1. Translate (x 1, y 1, z 1) to the origin 2. Rotate (x’ 2, y’ 2, z’ 2) on to the z axis 3. Rotate the object around the z-axis 4. Rotate the axis to the original orientation 5. Translate the rotation axis to the original position
Rotation about an Arbitrary Axis o Step 1. Translation y (x 2, y 2, z 2) (x 1, y 1, z 1) x z
Rotation about an Arbitrary Axis o Step 2. Establish y (0, b, c) Projected Point (a, b, c) x z Rotated Point
Rotation about an Arbitrary Axis o Step 3. Rotate about y axis by y (a, b, c) Projected Point l d x (a, 0, d) z Rotated Point
Rotation about an Arbitrary Axis o Step 4. Rotate about z axis by the desired angle y l z x
Rotation about an Arbitrary Axis o Step 5. Apply the reverse transformation to place the axis back in its initial position y l l z x
Rotation about an Arbitrary Axis Find the new coordinates of a unit cube 90º-rotated about an axis defined by its endpoints A(2, 1, 0) and B(3, 3, 1).
Rotation about an Arbitrary Axis o Step 1. Translate point A (2, 1, 0) to the origin y B’(1, 2, 1) A’(0, 0, 0) z x
Rotation about an Arbitrary Axis o Step 2. Rotate axis A’B’ about the x axis by and angle , until it lies on the xz plane. y Projected point (0, 2, 1) z B’(1, 2, 1) l x B”(1, 0, 5)
Rotation about an Arbitrary Axis o Step 3. Rotate axis A’B’’ about the y axis by and angle , until it coincides with the z axis. y (0, 0, 6) l x B”(1, 0, 5) z
Rotation about an Arbitrary Axis o Step 4. Rotate the cube 90° about the z axis Finally, the concatenated rotation matrix about the arbitrary axis AB becomes,
Rotation about an Arbitrary Axis
Rotation about an Arbitrary Axis o Multiplying [TR]AB by the point matrix of the original cube
Rotation about an Arbitrary Axis o Reflection Relative to the xy Plane y y z z x o Z-axis Shear x
Q 1 - Translate by <1, 1, 1> o A translation by an offset (tx, ty, tz) is achieved using the following matrix: o So to translate by a vector (1, 1, 1), the matrix is simply:
Q 2 - Rotate by 45 degrees about x axis o So to rotate by 45 degrees about the x-axis, we use the following matrix:
Q 3 - Rotate by 45 about axis <1, 1, 1> o So a rotation by 45 degrees about <1, 1, 1> can be achieved by a few succesive rotations about the major axes. Which can be represented as a single composite transformation nx = 1 ny = 1 SO nz = 1
Q 3 - Arbitrary Axis Rotation o The composite transformation can then be obtained as follows: = ? ? x y z
Directions vs. Points o We have looked at transforming points o Directions are also important in graphics o Viewing directions o Normal vectors o Ray directions (1, 1) (-2, -1) o Directions are represented by vectors, like points, and can be transformed, but not like points o Say we define a direction as the difference of two points: d=a–b. This represents the direction of the line between two points o Now we translate the points by the same amount: a’=a+t, b’=b+t o Have we transformed d?
Homogeneous Directions o Translation does not affect directions! o Homogeneous coordinates give us a clear way of handling this, e. g. , direction (x, y) becomes homogeneous direction (x, y, 0), and remains the same after translation: o (x, y, 0) is a vector, (x, y, 1) is a point. o The same applies to rotation and scaling, e. g. , scaling changes the length of vector, but not direction o Normal vectors are slightly different though (can’t always use the matrix for points to transform the normal vector)
Alternative Rotations o Specify the rotation axis and the angle (Open. GL method) o Euler angles: Specify how much to rotate about X, then how much about Y, then how much about o These are hard to think about, and hard to compose o Quaternions o 4 -vector related to axis and angle, unit magnitude, e. g. , rotation about axis (nx, ny, nz) by angle : o Only normalized quaternions represent rotations, but you can normalize them just like vectors, so it isn’t a problem o But we don’t want to learn all the maths about quaternions in this module, because we have to learn how to create a basic application before trying to make rotation faster
Open. GL Transformations o Open. GL internally stores two matrices that control viewing of the scene o The GL_MODELVIEW matrix for modelling and world to view transformations o The GL_PROJECTION matrix captures the view to canonical conversion o Mapping from canonical view volume into window space is through a gl. Viewport function call o Matrix calls, such as gl. Rotate, gl. Translate, gl. Scale right multiply the transformation matrix M with the current matrix C (e. g. , identity matrix initially), resulting in CM - the last one is the first applied
- Pre and post coordinate indexing system
- Is co a covalent bond
- Differential surface area in cylindrical coordinates
- Rotating coordinate systems
- Screen coordinate
- Coordinate rotation digital computer
- Decision support systems and intelligent systems
- Dicapine
- Embedded systems vs cyber physical systems
- Elegant systems
- Computer control of manufacturing systems
- Ecor 1010
- Dedicated computers
- Distributed system in computer network
- What is motion specification in computer graphics
- Computer systems unit
- In css nc ii, avr stands for
- Unit 2 computer systems assignment 1
- The protection of information in computer systems
- What are the advantages of computerized accounting
- Computer assisted guidance systems
- Computer systems
- Cs 1104 final exam
- Cit 595 upenn
- Computer systems components
- Computer performance evaluation
- Cit 593
- Integration using tables and computer algebra systems
- 15-213 introduction to computer systems
- Btec level 3 unit 2 computer systems assignments
- Unit 2 computer architecture answers
- Unit 2 computer systems
- 15-213 introduction to computer systems
- Define components of computer
- What is computer organization