Download presentation

Presentation is loading. Please wait.

Published byJocelyn Whalen Modified over 3 years ago

1
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 2 Basic Modelling

2
2GR2-00 Polygonal Representation n Any 3D object can be represented as a set of plane, polygonal surfaces V1 V2 V3 V4 V5 V8 V7 V6 Note: each vertex part of several polygons

3
3GR2-00 Polygonal Representation n Objects with curved surfaces can be approximated by polygons - improved approximation by more polygons

4
4GR2-00 Scene Organisation n Scene = list of objects n Object = list of surfaces n Surface = list of polygons n Polygon = list of vertices scene object surfacespolygons vertices

5
5GR2-00 Polygon Data Structure V1 V2 V3 V4 V5 V8 V7 V6 P1 P2 Object Table Obj1 P1, P2, P3, P4, P5, P6 Object Obj1 Vertex Table V1X1, Y1, Z1 V2X2, Y2, Z2.... Polygon Table P1V1, V2, V3, V4 P2V1, V5, V6, V2....

6
6GR2-00 Typical Primitives n Graphics systems such as OpenGL typically support: – triangles, triangle strips and fans – quads, quad strips – polygons n Which way is front? – convention is that normal points towards you if vertices are specified counter- clockwise

7
7GR2-00 Modelling Regular Objects n Sweeping n Spinning 2D Profile sweep axis spinning axis R1 R2

8
8GR2-00 Sweeping a Circle to Generate a Cylinder as Polygons vertices at z=0 vertices at z=depth V1 V2 V3 V4 V5 V6V8 V7 V10 V9 V11 V12 V13 V14 V15 V16 V17 V18 V1[x] = R; V1[y] = 0; V1[z] = 0 V2[x] = R cos ; V2[y] = R sin ; V2[z] = 0 ( = /4) Vk[x] = R cos k ; Vk[y] = R sin k ; Vk[z] = 0 where k = 2 (k - 1 )/8, k=1,2,..8

9
9GR2-00 Exercise and Further Reading n Spinning: – Work out formulae to spin an outline (in the xy plane) about the y-axis n READING: – Hearn and Baker, Chapter 10

10
10GR2-00 Complex Primitives n Some systems such as VRML have cylinders, cones, etc as primitives – polygonal representation calculated automatically n OpenGL has a utility library (GLU) which contains various high-level primitives – again converted to polygons n For conventional graphics hardware: – POLYGONS RULE!

11
11GR2-00 Automatic Generation of Polygonal Objects n 3D scanners - or laser rangers - are able to generate computer representations of objects – object sits on rotating table – contour outline generated for a given height – scanner moves up a level and next contour created – successive contours stitched together to give polygonal representation

12
12GR2-00 A Puzzle

13
13GR2-00 Modelling Objects and Creating Worlds boundary representations n We have seen how boundary representations of simple objects can be created co-ordinate system n Typically each object is created in its own co-ordinate system translationscaling rotation n To create a world, we need to understand how to transform objects so as to place them in the right place - translation, at the right size - scaling, in the right orientation- rotation

14
14GR2-00 Transformations n The basic linear transformations are: – translation: P = P + T, where T is translation vector – scaling: P = S P, where S is a scaling matrix – rotation: P = R P, where R is a rotation matrix homogeneous n As in 2D graphics, we use homogeneous co-ordinates in order to express all transformations as matrices and allow them to be combined easily

15
15GR2-00 Homogeneous Co-ordinates n In homogeneous coordinates, a 3D point P = (x,y,z) T is represented as: P = (x,y,z,1) T n That is, a point in 4D space, with its extra co-ordinate equal to 1 n Note n Note: in homogeneous co-ordinates, multiplication by a constant leaves point unchanged – ie (x, y, z, 1) T = (wx, wy, wz, w) T

16
16GR2-00 Translation n Suppose we want to translate P (x,y,z) T by a distance (Tx, Ty, Tz) T n We express P as (x, y, z, 1) T and form a translation matrix T as below n The translated point is P TP xyz1xyz1 P = 1 0 0 Tx 0 1 0 Ty 0 0 1 Tz 0 0 0 1 xyz1xyz1 = x + Tx y + Ty z + Tz 1 =

17
17GR2-00 Scaling relative to the origin n Scaling by Sx, Sy, Sz relative to the origin: xyz1xyz1 Sx 0 0 0 0 Sy 0 0 0 0 Sz 0 0 0 0 1 xyz1xyz1 P = SP = = Sx. x Sy. y Sz. z 1

18
18GR2-00 Rotation with respect to an axis n Rotation is specified with respect to an axis - easiest to start with co-ordinate axes n To rotate about the x-axis: a positive angle corresponds to counterclockwise direction looking at origin from positive position on axis EXERCISE: write down the matrices for rotation about y and z axes xyz1xyz1 =1 0 0 0 0 cos -sin 0 0 sin cos 0 0 0 0 1 xyz1xyz1 P= R z ( ) P

19
19GR2-00 Composite Transformations n The attraction of homogeneous co-ordinates is that a sequence of transformations may be encapsulated as a single matrix with respect to a fixed position (a,b,c) n For example, scaling with respect to a fixed position (a,b,c) can be achieved by: – translate fixed point to origin- say, T(-a,-b,-c) – scale- S – translate fixed point back to its starting position- T(a,b,c) n Thus: P = T(a,b,c) S T(-a,-b,-c) P = M P

20
20GR2-00 Rotation about a Specified Axis n It is useful to be able to rotate about any axis in 3D space n This is achieved by composing 7 elementary transformations

21
21GR2-00 Rotation through about Specified Axis x y z x y z rotate through requd angle, x y z x y z P2 P1 x y z P2 P1 x y z initial position translate P1 to origin rotate so that P2 lies on z-axis (2 rotations) rotate axis to orig orientation translate back

22
22GR2-00 Inverse Transformations n As in this example, it is often useful to calculate the inverse of a transformation – ie the transformation that returns to original state n Translation: T -1 (a, b, c) = T (-a, -b, -c) n Scaling: S -1 ( Sx, Sy, Sz ) = S............ Rotation: R -1 z ( ) = R z (- )

23
23GR2-00 Rotation about Specified Axis n Thus the sequence is: T -1 R -1 x ( ) R -1 y ( ) R z ( ) R y ( ) R x ( ) T EXERCISE: How are and calculated? n READING: – Hearn and Baker, chapter 11.

Similar presentations

Presentation is loading. Please wait....

OK

CMPE 466 COMPUTER GRAPHICS

CMPE 466 COMPUTER GRAPHICS

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on republic day of india 2012 Ppt on evolution of human resource management Seminar ppt on android Ppt on landing gear system diagram Ppt on credit policy for customers Plasma panel display ppt online Lymphatic system anatomy and physiology ppt on cells Ppt on transcription and translation Ppt on types of plants Ppt on suspension type insulators organization