- By
**issac** - Follow User

- 200 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about 'Computer Graphics Conceptual Model' - issac

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Computer GraphicsConceptual Model

API

Output

Devices

Application

Model

Graphics

System

Application

Program

Input

Devices

Function Calls

or Protocol

Data

Modeling in Three DimensionsTwo Approaches

- Constructive Solid Geometry (CSG)
- Primitives are a small set of volumetric objects such as cube, pyramid, sphere, etc.
- Objects built from normalized set operations on these objects
- Boundary (surface) representation
- Objects are described by their surfaces and can be thought of as being hollow
- Surfaces composed (approximated) by simple, convex, planar polygons
- Objects can be specified through a set of vertices in three dimensions
- Implies underlying coordinate system
- Duality: Object <--> Object representation

A

3

B

2

C

1

D

E

F

Representation of a CubeSurface Representation Data StructureVERTEX

LISTS

FACES

VERTICES

5

6

X0, Y0, Z0

X1, Y1, Z1

1

X2, Y2 , Z2

2

X3, Y3 , Z3

4

7

X4, Y4 , Z4

3

X5, Y5 , Z5

7

0

3

X6, Y6 , Z6

6

X7, Y7 , Z7

2

Representation:

data structure

.

.

.

Object: set of points

Transformations

- Maps an object into another object
- In general, a transformation maps every point on an object to another point in the underlying coordinate space.
- Why do we want/need transformations?
- Change size, location, orientation of objects without changing underlying model (or primitive drawing commands)
- Animation
- Instancing

Transformation

Object New Object

Representation New Representation

Operation

Abstract Data Types:Affine Space

- Scalar a, b, d, e
- Magnitude (e.g. real numbers)
- Vector u, v, w, x
- Direction
- Magnitude
- No Position
- Point P, Q, R, X
- Position
- No Direction
- No Magnitude

Defined Operations:Scalars

- Addition: a+b
- Additive identity: zero
- Additive inverse: - b
- Subtraction defined in terms of additive inverse
- Multiplication: d * j
- Multiplicative identity: 1
- Multiplicative inverse: 1/ d
- Division defined in terms of multiplicative inverse

q

v

Defined Operations:VectorsDot Product

Cross Product

Addition

v

u

u + v

q

v

u

Produces vector w

orthogonal to u and v.

u · v = | u | | v | cos q

Magnitude

(produces scalar)

| u | = b

w = u x v

| w | = | u | | v | sin q

(produces

scalar)

Defined Operations:Scalars and Vectors

Multiplication of vector by scalar:

Produces vector

u

v = a u

|a u | = a | u |

Defined Operations:Points and Vectors

Affine Addition:

Point + Vector = Point

Q

v

P

Q = P + v

Related to point subtraction.

Lines in Affine Space

R’

R

Q

v

Q = P + v

P

R = P + a v

- ¥ < a < ¥

Line segment from P to Q defined when:

0 £ a £ 1

Planes in Affine Space

Planes are defined uniquely by three points: P, Q, R

W(l)

Q

u = Q - P

v = R - P

u

T( b)

R

P

v

S(a)

S(a) = P + a v

T(b) = P + b u

W(a, b, l) = S +l (T - S) = P + a v + l (b u - a v)

W (a, b, l) = P + a ( 1 - l ) v + l b u

W = P + d v + c u

Homogeneous Coordinates

Frame is specified by:

where

are linearly independent basis

vectors and P0 arbitrary point

Frame

Homogeneous

coordinate

representation:

x

Transform as aChange of Framey’

Want to translate by:Dx = 2, Dy=4

(2, 3) in x’y’

(4,7) in x y

y

x’

(2, 3)

Dx = 2, Dy=4

x

1. Transform frame

2. Find representation in original frame

Transformation Matrix

Original Frame:

Transformed Frame:

Express elements of transformed frame in original frame:

where:

is representation in transformed frame

is representation in original frame

Transformation of Representationwhere

is of the form:

Affine Transformation:Line Preservation

Matrix multiplication is linear. Therefore:

T(p)+aT(v)

p+av

v

T(v)

p

T(p)

Meets our requirements!

Scaling

Scale the new frame:

Rotation About x and y axes

Similar derivations give:

Concatenation of Transformations

Apply T1, Then apply T2:

OpenGL Matrix Operations

glLoadIdentity();

Loads an identity matrix onto the top of the current stack

glLoadMatrixf(pointer_to_matrix);

Loads arbitrary matrix onto top of the current stack

glMultMatrixf(pointer_to_matrix);

Postmultiplies current matrix by arbitrary matrix

Matricies are one-dimensional arrays of type GLfloat

in column major order.

Predefined Postmultiplier Operatorsin OpenGL

glTranslatef(dx, dy, dz);

Multiplies current matrix with translation matrix. dx,

dy, and dz are translations along x,y, and z axes.

glRotatef(angle, x, y, z);

Multiplies current matrix with rotation about the line

from the origin through the point (x, y, z) by angle.

Right hand rule applies. Angle in degrees.

glScalef(sx, sy, sz);

Multiplies current matrix with scaling matrix. sx, sy, sz

are the scale factors along the x, y, and z axes.

Current

Current

Stack

Stack

Transformation Matrices in OpenGLMatrix Mode

3D

Model

Vertices

2D

3D

Vertices

Modelview

Projection

Download Presentation

Connecting to Server..