In the name of God Computer Graphics. Overview Introduction Geometry Interaction Graphic systems Graphics Standards.

Post on 18-Jan-2016

217 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

Transcript

In the name of God

Computer Graphics

Overview

• Introduction

• Geometry

• Interaction

• Graphic systems

• Graphics Standards

Is Computer Graphics Important?

Graphics Systems

• Interface between users and application software

• Consists of input subroutines and output subroutines accepting input data or commands from a user and converting internal representations into external pictures on screen, respectively

Software Portability and Graphics Standards

• It used to be low-level and device dependent packages supplied by the vendor, making it very difficult to port the software.

• We have now moved to high-level device independent packages, which allow much easier porting of software.

• Several standard device-independent graphics libraries are based on geometric modeling.

• Graphics Software Standards:– CORE -- 3D Core Graphics Systems -- a

specification produced by an ACM SIGGRAPH committee in 1977.

– GKS - Graphical Kernel System -- (1985) cleaned up and implemented the 2D portion of CORE.

– GKS-3D (1988) -- implemented CORE’s 3D portions.

• Permitted the grouping of primitives (such as lines, polygons, and character strings -- and their attributes) into collections.

Graphics Software History(1)

– PHIGS - Programmers Hierarchical Interactive Graphics System (1988)

• PHIGS also supports a retained database of structures, and automatically updated the screen when the database had been altered.

– PHIGS+ (1992) • added features for photorealistic rendering.

– Other standards• Postscript

• X-Windows

• OpenGL

• PEX

Graphics Software History(2)

3D Graphics

• Goal: To produce 2D images of a mathematically described 3D environment

• Issues:– Describing the environment: Modeling– Computing the image: Rendering

• What does it take to describe a scene?

Graphics Toolkits• Graphics toolkits typically take care of the details of producing

images from geometry• Input (via API functions):

– Where the objects are located and what they look like– Where the camera is and how it behaves– Parameters for controlling the rendering

• Functions (via API):– Perform well defined operations based on the input environment

• Output: Pixel data in a framebuffer – an image in a special part of memory– Data can be put on the screen– Data can be read back for processing (part of toolkit)

OpenGL

• OpenGL is an open standard graphics toolkit– Derived from SGI’s GL toolkit

• Provides a range of functions for modeling, rendering and manipulating the framebuffer

• Why use it?• Alternatives: Direct3D, Java3D - more complex

and less well supported respectively

Coordinate Systems(1)

• The use of coordinate systems is fundamental to computer graphics

• Coordinate systems are used to describe the locations of points in space

• Multiple coordinate systems make graphics algorithms easier to understand and implement

Coordinate Systems (2)• Different coordinate systems represent the same

point in different ways

• Some operations are easier in one coordinate system than in another– For instance, given a point and a box, which coordinate

system makes it easy to determine if the point is in the box?

x

y(2,3)

u

v

x

y(1,2)

u

v

Transformations• Transformations convert points between

coordinate systems

x

y(2,3)v

x

y(1,2)

u

v

u

u=x-1v=y-1

x=u+1y=v+1

Transformations(Alternate Interpretation)

• Transformations modify an object’s shape and location in one coordinate system

• The previous interpretation is better for some problems, this one is better for others

x

y(2,3)

(1,2)

x

yx’=x-1y’=y-1

x=x’+1y=y’+1

2D Translation

• Moves an object

?

?

??

??

y

x

y

x

x

y

x

y

bx

by?

2D Translation

• Moves an object

y

x

b

b

y

x

y

x

10

01

x

y

x

y

bx

by

2D Scaling

• Resizes an object in each dimension

x

y

xy

x

y

sxx

syy

?

?

??

??

y

x

y

x

2D Scaling

• Resizes an object in each dimension

x

y

0

0

0

0

y

x

s

s

y

x

y

x

xy

x

y

sxx

syy

2D Rotation• Rotate counter-clockwise about the origin

by an angle

x

y

x

y

?

?

??

??

y

x

y

x

2D Rotation

• Rotate counter-clockwise about the origin by an angle

0

0

cossin

sincos

y

x

y

x

x

y

x

y

X-Axis Shear

• Shear along x axis (What is the matrix for y axis shear?)

x

y

x

y

?

?

??

??

y

x

y

x

X-Axis Shear

• Shear along x axis (What is the matrix for y axis shear?)

0

0

10

1

y

xsh

y

x x

x

y

x

y

Reflect About X Axis

• What is the matrix for reflect about Y axis?

x x

?

?

??

??

y

x

y

x

Reflect About X Axis

• What is the matrix for reflect about Y axis?

0

0

10

01

y

x

y

x

x x

Rotating About An Arbitrary Point

• What happens when you apply a rotation transformation to an object that is not at the origin?

x

y

?

Rotating About An Arbitrary Point

• What happens when you apply a rotation transformation to an object that is not at the origin?– It translates as well

x

y

x

How Do We Fix it?

• How do we rotate an about an arbitrary point?– Hint: we know how to rotate about the origin of

a coordinate system

Rotating About An Arbitrary Point

x

y

x

y

x

y

x

y

Rotate About Arbitrary Point

• Say you wish to rotate about the point (a,b)• You know how to rotate about (0,0)• Translate so that (a,b) is at (0,0)

x’=x–a, y’=y–b

• Rotatex”=(x-a)cos-(y-b)sin, y”=(x-a)sin+(y-b)cos

• Translate back againxf=x”+a, yf=y”+b

Scaling an Object not at the Origin

• What also happens if you apply the scaling transformation to an object not at the origin?

• Based on the rotating about a point composition, what should you do to resize an object about its own center?

Back to Rotation About a Pt

• Say R is the rotation matrix to apply, and p is the point about which to rotate

• Translation to Origin:• Rotation:• Translate back:• The translation component of the composite

transformation involves the rotation matrix. What a mess!

pxx RpRxpxRxRx )(

pRpRxpxx

Basic Transformations

• Translation: Rotation:

• Scaling:

100

10

01

y

x

b

b

100

00

00

y

x

s

s

100

0cossin

0sincos

3D Translation

11000

100

010

001

1

z

y

x

t

t

t

z

y

x

z

y

x

top related