computer graphics conceptual model
Download
Skip this Video
Download Presentation
Computer Graphics Conceptual Model

Loading in 2 Seconds...

play fullscreen
1 / 33

Computer Graphics Conceptual Model - PowerPoint PPT Presentation


  • 200 Views
  • Uploaded on

Computer Graphics Conceptual Model API Output Devices Application Model Graphics System Application Program Input Devices Function Calls or Protocol Data Modeling in Three Dimensions Two Approaches Constructive Solid Geometry (CSG)

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
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 graphics conceptual model
Computer GraphicsConceptual Model

API

Output

Devices

Application

Model

Graphics

System

Application

Program

Input

Devices

Function Calls

or Protocol

Data

modeling in three dimensions two approaches
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
representation of a cube surface representation data structure

0

A

3

B

2

C

1

D

E

F

Representation of a CubeSurface Representation Data Structure

VERTEX

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
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
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
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
defined operations vectors

u

q

v

Defined Operations:Vectors

Dot 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
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
Defined Operations:Points and Vectors

Affine Addition:

Point + Vector = Point

Q

v

P

Q = P + v

Related to point subtraction.

defined operations points
Defined Operations:Points

Subtraction

(Addition of points

has no meaning.)

P

u = P - R

R

Produces vector

lines in affine space
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 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

representations of points and vectors
Representations of Points and Vectors

Coordinate system:

y

P (x, y, z)

v

x

z

where:

homogeneous coordinates
Homogeneous Coordinates

Frame is specified by:

where

are linearly independent basis

vectors and P0 arbitrary point

Frame

Homogeneous

coordinate

representation:

transform as a change of frame

y

x

Transform as aChange of Frame

y’

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

transform as a change of frame20
Transform as aChange of Frame

Representation:

Frame:

transformation matrix
Transformation Matrix

Original Frame:

Transformed Frame:

Express elements of transformed frame in original frame:

where:

transformation of representation

is representation in transformed frame

is representation in original frame

Transformation of Representation

where

is of the form:

affine transformations
Affine Transformations

T(point) -> point

T(vector) -> vector

affine transformation line preservation
Affine Transformation:Line Preservation

Matrix multiplication is linear. Therefore:

T(p)+aT(v)

p+av

v

T(v)

p

T(p)

Meets our requirements!

translation
Translation

Assumptions:

Translate the new frame:

scaling
Scaling

Scale the new frame:

rotation
Rotation

Rotation around the z axis:

q

rotation about x and y axes
Rotation About x and y axes

Similar derivations give:

concatenation of transformations
Concatenation of Transformations

Apply T1, Then apply T2:

opengl matrix operations
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 operators in opengl
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.

transformation matrices in opengl

Load Matrix

Current

Current

Stack

Stack

Transformation Matrices in OpenGL

Matrix Mode

3D

Model

Vertices

2D

3D

Vertices

Modelview

Projection

ad