Description

2M050: PC Design Jack van Wijk vanwijk@win.tue.nl HG6.71 Points Present essential representation ideas and phrasing Base for advancement of 2D intelligent PC illustrations programs (OGO 2.3) Writing

Transcripts

2M050: Computer Graphics Jack van Wijk vanwijk@win.tue.nl HG6.71

Aims Introduce essential representation ideas and phrasing Base for advancement of 2D intuitive PC design programs (OGO 2.3)

Literature Computer Graphics - Principles and Practice Foley - van Dam - Feiner - Hughes second release in C - Addison and Wesley Computer Graphics - C Version Donald Hearn - M. Pauline Baker second version - universal release Prentice Hall

Overview Introduction Geometry Interaction Raster representation

Introduction What is Computer Graphics? Applications Computer Graphics in Eindhoven Raster/vector representation Hardware

Computer Graphics Computer Graphics is pervasive: Visual framework is most vital sense: High transfer speed Natural correspondence Fast improvements in Hardware Software

Computer Graphics Image Analysis (design acknowledgment) Mathematical Model Image Synthesis (Rendering) Modeling Image preparing

Supporting Disciplines Computer science (calculations, information structures, programming building, â¦) Mathematics (geometry, numerical, â¦) Physics (Optics, mechanics, â¦) Psychology (Color, recognition) Art and outline

Applications Computer Aided Design (CAD) Computer Aided Geometric Design (CAGD) Entertainment (movement, diversions, â¦) Geographic Information Systems (GIS) Visualization (Scientific Vis., Inform. Vis.) Medical Visualization â¦

Computer Graphics Eindhoven Current: Information perception Interactive 3D outline Virtual reality Past: Rasterization, Animation Jack van Wijk Kees Huizing Arjan Kok Robert van Liere Wim Nuij Alex Telea Huub van de Wetering

Interactive Computer Graphics User data Application Screen picture

Model Geometry, shading Graphics pipeline User Edit Map Screen Display

Representations in illustrations Vector Graphics Image is spoken to by nonstop geometric articles: lines, bends, and so on. Raster Graphics Image is spoken to as a rectangular lattice of shaded squares

Vector design Graphics objects: geometry + shading Complexity ~ O(number of items) Geometric change conceivable without loss of data (zoom, pivot, â¦) Diagrams, plans, ... Illustrations: PowerPoint, CorelDraw, ...

Raster design Generic Image preparing methods Geometric Transformation: loss of data Complexity ~ O(number of pixels) Jagged edges, against associating Realistic pictures, surfaces, ... Samples: Paint, PhotoShop, ...

Conversion Vector design Rasterization, Pattern acknowledgment Scan transformation Raster representation

Hardware Vector illustrations Raster representation Color lookup table 3D rendering equipment

Display rundown move 10 20 line 20 40 ... burn O V E C T O R roast R Vector Graphics Hardware consistent & smooth lines no filled items arbitrary sweep invigorate pace relies on upon unpredictability of the scene Display Controller

Frame cushion 0 7 6 0 7 0 Raster Graphics Hardware Video Controller R A S T E R jaggies (stair packaging) filled articles (anti)aliasing revive speed free of scene multifaceted nature pixel check transformation determination bit planes

shading file Frame support R G B 0 7 6 102 255 53 1 0 7 0 255 204 2 0 255 102 153 4 0 ... 102 0 51 7 Color Lookup Table CLUT: pixel = code True shading: pixel = R,G,B

3D rendering equipment Geometric representation: Triangles Viewing: Transformation Hidden surface evacuation: z-cushion Lighting and brightening: Gouraud shading Realism: composition mapping Special impacts: straightforwardness, antialiasing

2D geometric demonstrating Coordinates Transformations Parametric and certain representations Algorithms

Coordinates Point: position on plane p = ( p x , p y ) x = ( x, y ) x = ( x 1 , x 2 ) x = x 1 e 1 + x 2 e 2 , e 1 = (1, 0), e 2 = (0, 1) Vector: course and size v = ( v x , v y ), and so forth y p v x

Vector number-crunching Addition of two vectors: v + w = ( v x + w x , v y + w y ) Multiplication vector-scalar: a v = ( a v x , a v y ) y v + w v x y 2 v x

Coordinate frameworks world train wheel picture

Why changes? Model of articles world directions: km, mm, and so forth various leveled models: human = middle + arm + arm + head + leg + leg arm = upperarm + lowerarm + hand â¦ Viewing zoom in, move drawing, and so on.

Transformation sorts Translate as per vector v : t = p + v Scale with component s : s = s p Rotate over edge a: r x = cos( a ) p x - sin( a ) p y r y = sin( a ) p x + cos( a ) p y s t r v p a x

Homogeneous directions Unified representation of turn, scaling, interpretation Unified representation of focuses and vectors Compact representation for successions of changes Here: helpful documentation, significantly more to it

Homogeneous arranges Extra facilitate included: p = ( p x , p y , p w ) or x = ( x, y, w ) Cartesian directions: partition by w x = ( x/w , y/w ) Here: for a point w = 1, for a vector w = 0

Matrices for change

Direct elucidation yâ ( x, y ) y ( xâ,yâ ) x b a t xâ

Translation network

Scaling framework

Rotation grid

xâââ yâââ xâ yâ xââ yââ Sequences of changes y x Sequences of changes can be portrayed with a solitary change lattice, which is the consequence of link of all changes.

yââ yâ yââ xââ y yâ xâ x Order of changes Matrix duplication is not commutative. Diverse requests of duplication give distinctive results.

Order of changes Pre-increase: xâ = M n M n-1 â¦M 2 M 1 x Transformation M n in worldwide directions Post-augmentation: xâ = M 1 M 2 â¦M n-1 M n x Transformation M n in neighborhood organizes, i.e., the direction framework that outcomes from utilization of M 1 M 2 â¦M n-1

Window and Viewport: Area on screen to be utilized for drawing. Unit: pixels (screen directions) Note: y - pivot regularly focuses down Window: Virtual region to be utilized by application Unit: km, mm,â¦ (world directions) (800,600) (600,400) (200,200) (0,0) (2,1) (- 2,- 1)

Window/viewport change Determine a network M, such that the window (w x1 , w x2 , w y1 , w y2 ) is mapped on the viewport (v x1 , v x2 , v y1 , v y2 ): A = T(- w x1 , - w y1 ) B = S(1/(w x2 - w x1 ), 1/(w y2 - w y1 )) A C = S(v x2 - v x1 ,v y2 - v y1 )B M = T(v x1 , v y1 ) C

Forward and in reverse ( v x2 , v y2 ) Viewport xâ: screen directions Drawing : (meters to pixels) Use x â = M x Picking : (pixels to meters) Use x = M - 1 xâ ( v x1 , v y1 ) Drawing Picking ( w x2 , w y2 ) Window: x : client facilitates ( w x1 , w y1 )

Implementation sample Suppose, essential library bolsters two capacities: MoveTo(x, y: number); LineTo(x, y: whole number); x and y in pixels. How to make life less demanding?

State variables Define state variables: Viewport: array[ 1.. 2 , 1.. 2] of number; Window: array:[ 1.. 2 , 1.. 2] of genuine; Mwv, Mobject: array[ 1.. 3 , 1.. 3] of genuine; Mwv: change from world to see Mobject: additional item change

Procedures Define coordinate framework: SetViewPort(x1, x2, y1, y2): Update Viewport and Mwv SetWindow(x1, x2, y1, y2): Update Window and Mwv

Procedures (proceeded with) Define object change: ResetTrans: Mobject := IdentityMatrix Translate(tx, ty): Mobject := T(tx,ty)* Mobject Rotate(alpha): Mobject := R(tx,ty)* Mobject Scale(sx, sy): Mobject := S(sx, sy)* Mobject

Procedures (kept) Handling progressive models: PushMatrix(); Push an article change on a stack; PopMatrix() Pop an article change from the stack. Then again: GetMatrix(M); SetMatrix(M);

Procedures (kept) Drawing methods: MyMoveTo(x, y): (xâ, yâ) = Mwv*Mobject*(x,y); MoveTo(xâ, yâ) MyLineTo(x,y): (xâ, yâ) = Mwv*Mobject*(x,y); LineTo(xâ, yâ)

Application DrawUnitSquare: MyMoveTo(0, 0); MyLineTo(1, 0); MyLineTo(1, 1); MyLineTo(0, 1); MyLineTo(0, 0); Initialize: SetViewPort(0, 100, 0, 100); SetWindow(0, 1, 0, 1); Main project: Initialize; Translate(- 0.5, - 0.5); for i := 1 to 10 do start Rotate(pi/20); Scale(0.9, 0.9); DrawUnitSquare; end;

Puzzles Modify the window/viewport change for a presentation y-hub directing downwards. How to keep up perspective proportion world->view? Which state variables? Characterize a change that changes a unit square into a âwybertjeâ, based on the root with width w and tallness h .

Geometry Dot item, determinant Representations Line Ellipse Polygon

Good and awful Good: symmetric in x and y Good: frameworks, vectors Bad: y = f(x) Good: dab item, determinant Bad: arcsin, arccos

Dot item w q v |w| cos q

Dot item properties

Determinant w q v q w Det ( v , w ): marked region of parallellogram Det ( v , w ) = 0 iff v and w are parallel

Curve representations Parametric: x ( t ) = ( x ( t ), y ( t )) Implicit: f( x )