Professional Documents
Culture Documents
Elements of Computer Graphic
Elements of Computer Graphic
Contents
o Introduction
o Key points and intermediate points
o Classic animation
o Current animation
o Automate animation - fragmentation
o Linear interpolation
o Speed control and linear interpolation
o Curve interpolation - Spline
o Movement control on the curve trajectory
o Orientation interpolation
o Camera movement
o Complex objects animation
o Articulated structures kinematics
o Other animations: morphism, movement caption, particle system,
groups
v2 v1, v2
v
v1 u1, u2
v
Interpolator
u
u1 u u2
ui+1 = ui + ∆u
vi+1 = vi + ∆v
Pi Pn
P0
p 0 t1 - p 1 t0 p1 - p0
p(t) = +t (3)
t 1- t 0 t 1- t 0
p1 - p0
p(t + ∆t) = p(t)+ ∆t (4)
t 1- t 0
o Dezavantaje:
n Calculul punctelor de control al curbelor spline se face pe baza unor
constringeri de interpolare definite pentru punctele de control
n Sunt necesare informatii suplimentare (Ex. vectorii tangenta la capete)
Ref: Automatic Splicing for Hand and Body Animations Majkowska, A., Zordan, V. B., Faloutsos, P.
ACM SIGGRAPH/Eugorgraphics Symposium on Computer Animation (SCA) 2006
P(x,y,z)
n Triangulatie prin ultrasunete. Simplu dar mai putin precis decit senzorii
magnetici.
n Triangulatie optica. Sunt atasati emitatori pe obiectul urmarit. Doua camere
determina pozitia. Poate urmari mai multe puncte, fara a folosi cabluri.
n Costume de corp. Senzori care determina unghiurile din incheieturi sunt
inserati in tesatura hainelor.
n Obiecte cu comportament haotic. Exemple: nori, foc, apa, iarba, blana, etc.
2. Aliniere
Alinierea la orientarea medie a grupului
local
3. Coeziune
Deplasare spre pozitia medie a grupului
local
o Ref.: Craig Reynolds, Boids,
http://www.red3d.com/cwr/boids/ (1986).
Projections
Viewing transformation
Remarks
xL
yV
yS
xS xV Center of
V
zV Projection,
U Viewer’s
N Position
xwc
ywc
window pixel
viewport
Window definition Viewport definition Window’s content Scan conversion onto the
in projection plane in projection plane inside the viewport raster screen
Parallel Perspective
Isometric Others
Parallel projection
Parallel projection rays. Convergence point at infinity.
Viewer’s position at infinity.
A
Projection Projection
plane plane
A’ A
A’
8
Center of B
Center of B B’
B’ projection
projection
Oblique
Direction of projection is different than the normal vector
Projection Projection
plane plane
A’ A’
B’ A B’
A n
n B
B
Front-elevation
Top-elevation
Projection plane is perpendicular
to the z axis
y
Side-elevation
Projection plane is perpendicular
to the x axis
Front-elevation
Side-
elevation
Axonometric
Isometric projection
Commonly used axonometric projection
Projetion plane normal (and direction of
projection) makes egual angles with each
principal axis
If the projection plane normal is (dx, dy,
dz), it requires that |dx|=|dy|=|dz|,
or ±dx= ±dy= ±dz
Isometric
Axonometric z
Isometric z
xp = x + z L1 cos φ
yp = y + z L1 sin φ
zp = 0
P(x,y,z)
z
xp 1 0 L1 cosφ 0 x
yp 0 1 L1 sinφ 0 y
=
zp 0 0 0 0 z
1 0 0 0 1 1
Cabinet projection
y y
Cavalier L L
L
L
β=45°, tgβ=1
z
z
L L
φ=45° φ=30°
x x
y
y
L L
Cabinet L/2 L/2
β=63.4°, tgβ=2 z
z L
L
φ=45° φ=30°
x x
Therefore:
P(x,y,z) u = z/(z+d)
xp = x – xz/(z+d) = x[1/(1+z/d)]
yp = y – yz/(z+d) = y[1/(1+z/d)]
zp = 0
z
Pp (xp, yp, 0) xp 1 0 0 0 x
x
yp 0 1 0 0 y
=
zp 0 0 0 0 z
P(x,y,z)
w 0 0 1/d 1 1
= [x/(1+z/d), y/(1+z/d), 0, 1]
One-point Two-point
perspective projection perspective projection
xL
yV
yS
xS xV Center of
V
zV Projection,
U Viewer’s
N Position
xwc
ywc
window pixel
viewport
Window definition Viewport definition Window’s content Scan conversion onto the
in projection plane in projection plane inside the viewport raster screen
V
yv
N
U zv
xv
Projection
plane
yw v
Pw
Pv=(xv,yv,zv)
Tv
n
u
zw xw
Pw = Tv + Pv = Tv + RvPv
xw xw xw
zw zw zw
(a) Original orientation of world and (b) Invert viewing (c) Translate viewing
viewing coordinate systems z axis origin to world origin
yw yw yw
yv
xv yv
xv
yv xv
zv
zv xw
xw xw
zw zv zw zw
(d) Rotate about world x axis (e) Rotate about the world (f) Rotate about the world
to bring viewing z axis into y axis to align z axis to align the two
the xz plane of the world system the two z axes viewing systems
xL
yV
yS
xS xV Center of
V
zV Projection,
U Viewer’s
N Position
xwc
ywc
window pixel
viewport
Window definition Viewport definition Window’s content Scan conversion onto the
in projection plane in projection plane inside the viewport raster screen
Viewport
yvmax
ywmin
yvmin
Window definition: (xwmin, xwmin, xwmax, ywmax) Viewport def: (xvmin, xvmin, xvmax, yvmax)
yw
(-60.5, 82.5) (41.25, 82.5)
1
Window 0.87
Viewport
0.50
0 xw
1 ymax
1 xmax
0 1
WC NDC PDC
y P8 y
P2
P7 Window Window
ywmax ywmax
P3
P9 P3 P4 P1 P4 P1
P’9
P10
P’10
P5 P5
ywmin ywmin
P6 P’6
y
C D
ywmax
B
A
ywmin
xwmin xwmax x
ywmax B
D
A C
ywmin
xwmin xwmax x
Basic Idea
n Encode the line endpoints
Region outcodes:
1000
D
1001 C
1010 S
B G H R
F
A 0000
0001 Q 0010
E P
N
M
0101 0100 0110
P1
tline
V4 tedge V3
P0
V1 V2
o Outside Inside
clipping clipping
rectangle rectangle
Edge Ei
PEi
P1
Ni ∙ [Pi(t) – PEi] = 0
Ni
P1
φ
t=1
N
PE P1 P1
N
φ Line 2 t=1 t=1
PL PL
PL PE Line 1
P0 Line 3
t=0
P0 PL
t=0
PE
Clipping rectangle
PE
P0
t=0
E1 L1
P Q E2
B
n
Computing normal vector of the edge: C
1. Compute the normal vector of the plane
N = AB x BC
(cross product of two consecutive edges)
2. Normal vector of the edge
n = AB x N
(cross product of the edge and normal
vector of the plane)
D
E1 L3
Q E2 L1 E3
P B
E
P5
P3
Cyrus-Beck algorithm:
o Simplifies the Cyrus-Beck algorithm for the particular case of clipping window as
an horizontal rectangle:
2. The dot product Ni ∙ (P0 – PEi) determining whether the endpoint P0 lies
inside or outside a specific edge, reduces to the directed horizontal or
vertical distance from the point to the edge.
If dx >0, the line moves from left to right and is PE for the left edge, PL
for the right edge, and so on.
o General definition:
n Sequence of vertices with implicit relationships
n By clipping: 1 polygon (v1, v2, …., vn) ®
p polygons (A11, A12, …, A1k; …Ap1, Ap2, …,Apq)
o Display:
n set of points
n set of lines (wire-frame)
n closed multicolor polyline
n set of polygons
n filled polygons
Original
Polygon
I
P S P
S
P S
I
P S
Window
3
Window
2 3 1’ 2’
2’ (8’)
2 1’
1 4 3’
5 4’
1 4
3’ 5’
6 6’
5’ 7’
6 4’
7
5 (a) (b)
Before Clipping
After Clipping
o 4 cases:
2
a) out - > in
b) in -> in
c) in -> out 1
d) out - > out
e) follow clip edge
4 3
2 2 2
2
1’ 1’ 1’ 1’
3’ 3 3
3
3’
2 2 2 2
1’ 1’ 1’ 1’
3 3’ 3 3’ 3 3’ 3
4 4 4
3’
4 4’ 4’ 4’
5 5 5
5’ 5’
2 2 2
1’
1’ 1 1’
3 3 3’ 3
3’ 3’ 4’
4 4 4’ 5
4’ 5 5
6 6 5’
5’ 5’
Final Result:
Continue from Nothing added. 2 unconnected
cached vertex and Finished polygons
direction
B A4 B4
A2 A3 A6 A5 B5
A7
A6
B4
A7
B2 A8 A9
A8
A9
B3 A10
A2 A3 C3 A6 A5 B5
A7
A6
B4
A7
B2 A8 A9
C4 A8
A9
B3 A10
A8
A9
A10
A8
A9
A10
A8
A9
A10
A8
A9
A10
A8
Entering vertex
Leaving vertex
A9
A10
Clipped polygons: A8
Polygon 1: C1, A2, A3, C2
Polygon2: C3, A7, A8, C4, B5 A9
A10
STRING1
All or none
text clipping
STRING2 STRING2
STRING1 ING1
All or none
character clipping
STRING3 TRING3
STRING4 STRING4
STRING1 STRING1
Clipping individual
character
Figure 1
E
B
P Q Q1 Q2
C D
Figure 2
A
A
b.
a.
Figure 3
c.
a. b.
Figure 4
a. b.
Figure 5
c.
a. B
A b. B
A
B
Figure 6
Figure 7
Figure 8
C
o Scan conversion
o Seed filling
1 2 3 4 5 6 7 8 9 10 11 12
o Run-length encoding
(intensity, run length)…○4●4○4●9……
o Cell-organization
o Frame buffer
o Flexibility 2
A
3
D
Edge list 1: Edge list 2: Edge list 3:
1 2 3 1 2 3 1 2 3
BC ← b BC BC BA ← b BA ← b BA BD ← b BD ← b BD ← b
BA BA ← b BA BC BC BC BA BA BA
BD ← e BD BD ← b BD ← e BD BD ← b BC ← e BC BC
CD CD ← e CD CD CD ← e CD CD CD ← e CD
AD AD AD ← e AD AD AD ← e AD AD AD ← e
0 30
0 7 1 8 0 15
0 1 1 2 0 20 1 2 0 5
Complex object B
A
OR
C
A B
1 12 11 2 3 10 9 4 5 8 7 6
1 2 3 4
1 2
1 2 3 4
1 2,3 4,5 6
1 2 3 4
1 2,3 4,5 6
4 4
3.5
3 3
2.5
2 2
1.5
1 1
0 1 2 3 4 5 6 0 1 2 3 4 5 6
8
P5
6 P3
Edge sorting on
y coordinate
4
P4
2
P2
P1
0 2 4 6 8 10
Scan line 4:
2 P4
x45+2∆x45, ∆x45, ∆y45 -2
x51+2∆x51, ∆x51, ∆y51 -2
P2
P1 x23+∆x23, ∆x23, ∆y23 -1
0 2 4 6 8 10 x34+∆x23, ∆x34, ∆y34 -1
P1
P3 P3
P2 P2 P4
P6 P6
P7
P4
P1
P7
P8 P8
P1
P3 P3
P2 P2 P4
Fence
P4
P1
P7
P8 P8
flag flag
in out
flag flag
in out
y y
x x
y y
Firt 3 2
course
ID
5 4
x x
3 2
5 4
A
A
Figure 1a Figure 1b B
E
D
B
D C
C
E
Elements of Computer Assisted Graphics 30
Questions and proposed problems
4. Explain the generation of the edge list if the scan line is moving
upward, instead downward.
5. Explain why the relationship between real polygon point, scan line and
pixel position is important?
6. How big could be the polygon rendering error?
7. Explain the Ordered Edge List algorithm on Figure 1a.
8. Explain the Ordered Edge List algorithm on Figure 1b.
9. Explain the Ordered Edge List algorithm on Figure 1a and b, if the scan
line is moving upward.
10. Explain how the Ordered Edge List algorithm depends on the upward
and downward movement of the scan line?
11. Why would the seed filling algorithm be disadvantageous?
12. What is the worst case for the recursive seed filling algorithm?
(x-xc)2 + (y-yc)2 = r2
y = yc ± sqrt((r2) - (x-xc)2) r
yc
xc
x = xc + r cosθ
y = yc + r sinθ
r
θ
yc
xc
y y
(-y, x) (y, x)
x x
r2 = radius * radius;
raster.setPixel(pix, xCenter, yCenter + radius);
raster.setPixel(pix, xCenter, yCenter - radius);
for (x = 1; x <= radius; x++) {
y = (int) (Math.sqrt(r2 - x*x) + 0.5);
raster.setPixel(pix, xCenter + x, yCenter + y);
raster.setPixel(pix, xCenter + x, yCenter - y);
raster.setPixel(pix, xCenter - x, yCenter + y);
raster.setPixel(pix, xCenter - x, yCenter - y);
}
}
Therefore:
if F(M) < 0, next point P(xi+1,yi+1) = E(xi+1,yi)
otherwise next point P(xi+1,yi+1) = SE(xi+1,yi-1)
x
Initial decision variable value:
d0 = F(0, R)= 5/4 - R
xL
yV
yS
xS xV Center of
V
zV Projection,
U Viewer’s
N Position
xwc
ywc
window pixel
viewport
Window definition Viewport definition Window’s content Scan conversion onto the
in projection plane in projection plane inside the viewport raster screen
8 neighbors 4 neighbors
x1 ∆x x2 x
Case 1: 0<m<1
Xi+1 = xi + 1
yi+1 = yi + m
Case 2: 1<m
yi+1 = yi + 1
xi+1 = xi + 1/m
m <1
1. Compute a decision
variable di=f(Pi, di-1)
NE
2. Depending on the di value yi + 1
chose the next position E n
or NE
Q
Pi s
yi
E
xi xi + 1
xi xi + 1
di = ∆x(s-n) = 2∆y(xi+1)-2∆xyi+∆x(2b-1)
= 2∆yxi -2∆xyi +[2∆y+∆x(2b-1)]
= 2∆yxi -2∆xyi + Const
di = 2∆yxi -2∆xyi + Const
if di < 0 then E(xi+1,yi)
if di ≥ 0 then NE(xi+1,yi+1)
d0 = 2∆y-2∆x
NE
yi + 1
M F(x,y)=0
Q
yi
E
xi xi + 1
F(x,y)=x∆y-y∆x+n∆x
NE if F(xi+1, yi+1/2)<0
x
E if F(xi+1, yi+1/2)>0
xi xi + 1
y
P2(x2,y2)
P2’(x2,y2)
P1(x1,y1)
P1’(x1,y1) P’
y
o Removing the stairstep
appearance of a line
o Staircase for raster effect
o Need some compensation in
line-drawing algorithm for the
raster effect
References
http://www.engineersgarage.com/articles/touchscreen-technology-
workinghnology
1. Output devices
o Hardcopy technology
o Display technology
o Raster system architectures
2. Input devices
Application
Application Graphics
Data
Program System
Structure
o Output device
n Graphics display, printer, plotter etc.
o Input device
o Logical
n locator, stroke, string, valuator, choice, pick
o Physical
n mouse, trackball, joystick, scanner, keyboard, etc
o Interactive device
n Graphics console, graphics tablet, head mounted display, etc.
pen carriage
Pen plotters include a
microcontroller
o Accepts graphics commands:
draw line, move, draw circle,
etc.
o Decomposes the output
primitives into incremental pen
movements:
∆x, ∆y, z, ∆u etc.
Color plotter
Multiple passes for fundamental colors
Colors: black, cyan, magenta, and yellow toners
One pass, multiple heads
Electric contacts
Bath of suspended
toner particles
Paper
paper movement
Selenium coated
drum
Deflection
Laser system
Laser beam
Scan line
Paper wrapped
around drum
Track
Ink jets
carriage
Horizontal
Focusing Deflection
System Plate
Heating
Filament
Electron Beam
Cathode
Control Accelerating Vertical
Grid System Deflection
Plate
Phosphor-
Coated
Color: Screen
Beam Penetration
Shadow Mask
Electron Gun
Screen
Phosphor
Green
beam Red beam
o Sharpness
energy
1 spot size inter-dot distance dot size, spot
dot pitch size
0.5 ~ 0.6
distance
electron beam
Input
Refresh
memory (Display file, frame buffer)
Flood Gun
Screen
Storage grid
Collector grid
Register DAC
1
Register
N
0 1 0 2N DAC
2
N=3 2N Levels
0 DAC Blue
1 DAC Green
0 DAC Red
N=3 2N Levels
Look-up tables
W
2W intensity levels
2N at a time
1010
2N entries 10
W=4
0 1 0
2
2W DAC
N=3 2N levels
Viewing
direction
Liquid-
Vertical Vertical Horizontal Horizontal Reflective
crystal
polarizer grid wires grid wires polarizer layer
layer
Color cell
Color Filter
Liquid Crystal
TFT
Viewing
direction
o CRT projector
o LCD projector
Realitate Virtuala 39
HMD - examples
Realitate Virtuala 40
HMD – Virtual glasses
Realitate Virtuala 41
HMD – Virtual glasses
Realitate Virtuala 42
HMD – Virtual glasses
Realitate Virtuala 43
Display-uri mari bazate pe monitoare
Realitate Virtuala 44
Binocular Omni-Orientation Monitor (BOOM)
Realitate Virtuala 46
Display-uri de mari dimensiuni
o Display grafic care afiseaza o scena virtuala destinata
vizualizarii simultane a mai multor utilizatori amplasati in
vecinatatea display-ului
n Imagini monoscopice
n Imagini stereoscopice
o Bazate pe monitoare
o Bazate pe proiectoare
Realitate Virtuala 47
Display-uri mari bazate pe monitoare
o Alternativa este folosirea
monitoarelor multiple
amplasate adiacent
o Probleme apar la
simularea la viteze mari
cand apar discontinuitati
intre imaginile de pe
monitoarele adiacente
Realitate Virtuala 48
Display-uri mari bazate pe proiectoare
Realitate Virtuala 49
Display-uri mari bazate pe proiectoare
Realitate Virtuala 50
Workbench
CPU Peripheral
devices
System bus
CPU Peripheral
devices
System bus
System Video
Monitor
memory controller
o System memory:
n Application program
n Graphics package
n Operating system Peripheral
CPU
devices
o Display processor:
n Raster operations
n Scan conversion
n Double-buffering
n I/O transfer on the System bus
system bus
Display System
processor memory
Display
Frame Video Monitor
processor
buffer controller
memory
o Cache memories
o Video RAM (VRAM)
(read out all pixels on a scan
line in one cycle)
Display Peripheral
CPU processor devices
System bus
o Text
o Graphic Tablet
a) Active tablet, passive pen.
b) Acoustic active pen, tablet with
microphones.
q 3-dimensional pen-style
haptic device that "makes it
possible for users to touch and
manipulate virtual objects
q 3D Touch-enabled Modeling for
Product Design
q The position and orientation of
the pen are tracked through
encoders in the robotic arm.
q Three degrees of force, in the
x, y and z, direction are achieved
through motors that apply
torques at each joint in the
robotic arm
ex. PHANTOM Desktop
1. Core
2. GKS
1. Functional levels
2. Graphics primitives
3. Coordinate systems
4. Window-viewport transformations
5. Graphics transformations
6. Graphics segments
3. Conclusion
Graphics model
5. Space dimension
CORE: 3D; GKS: 2D, 3D
6. Coordinate system
Application program transforms NDC to WC
GKS works on real world coordinate
7. Device control
CORE identifies the output device
GKS: workstations with associated list of attributes and
window/viewport pair.
Elements of Computer Assisted Graphics 4
GKS
o Graphical Kernel System
1984 (’85) GKS 2D
1988 GKS-3D
Application Program
Graphics Kernel
Operating System
Graphics Other
Resources Resources
Constructive Level
Virtual Level
Workstation Workstation
Attributes: P1
color: p x R + q x G + s x B
2. Polymarker
Attributes:
type: . + x * o
dimension: * * *
height:
expansion
Text
4. Fill-area
Text
5. Cell-array
World Normalized
20
coordinate device
system coordinate
system
30 x x
Data
Translat
e
Scale
Tooth
Data
Segment transformations
WC NDC PDC
Call
Data input
function
return Get
data
2. Sample mode
call
Call Maintain Data input
function data
return
3. Event mode
Application System
program
Data input
call
Wait for Wait Queue
event
event state data
return
call FIFO
Get Maintain
data data
return
Data
queue
xL
yV
yS
xS xV Center of
V
zV Projection,
U Viewer’s
N Position
xwc
ywc
window pixel
viewport
Window definition Viewport definition Window’s content Scan conversion onto the
in projection plane in projection plane inside the viewport raster screen
o OpenGL 1, Direct3D 2
o Retained-mode (RM)
o The scene (lines, shapes, images,…) is kept in memory
o The actual drawing is performed once, using the stored model
o The application simply adds and removes drawing primitives
o Offers abstraction
Immediate-mode Retained-mode
Application
Update
Application Build scene
Drawing
commands Scene Graphics library
Update
Graphics library Drawing
commands Scene
Display
Display
Fragment processing
Framebuffer image
Fragment processing
Framebuffer image
Fragment processing
Framebuffer image
wy cz
wz cx
Fragment processing
Framebuffer image
y y
z z
Rasterization
Fragments
Fragment processing
Framebuffer image
(x2, y2)
z
(x1, y1)
1. Motivation
2. Computer Graphics
3. Graphics Devices
4. Application Data Models
5. Graphics Systems
6. Conclusion
o Examples
o Definition
o Objectives
o Simulation
o Realism
o Interactivity
o Presence
.,,. .,,.
:XXXX,XXXX: .SSSSSSS'
.,;;;;;;;,. 'XXXXXXXXX' .SSSSSSSS,WW:, .''':,.
,;;;;;;;,/;;;; ':XXXXX:' .SSSSSSSSSS:WWW:, '::,
.,aa###########@a;;;;;/;;;,//;;; 'XXX' .SSSSSSSSS,WWW<*>WW '::, '////
..,,,.,aa##################@a;//;;;,//;;;
':' SSSSSSSSSSSS'WWWWWWD '::,////
,;;;;;;;O#####OO##############OOO###a,/;;;;' ,. SSSSSSS(((SSSWWWWW' ,WW//:.'.W.
.;;//,;;;O####OOO##########OOO####OOO#####a' ,((() 'SSSSSS(((WWWWWWWWWW) //'W,:WWWW'
.;;/,;;/;OO##OO#######################OOO####. ,(((((() 'SSSSSS((WWWWWWWWWW) // 'WWW,WWW
;;;/,;;//OO#######OOO###########OOO###########. .,(((((((()) 'SSSSWWWWWWWWWWW' // .WWWWW:,
`;;//,;,OOO#########OO#########OO##############.
.,((((((((((())), SSWWWWWWWWWW' // ,WWWW' ':,
;. ``````OOO#####;;;;;;OO#####OO;;;;;;######O####. .,((((((((((((((())))),.,,,,WWWWWWWWWW:, // ,WWWWW' ':
.;;, OOO###O;;' ~`;##OOOOO##;' ~`;;O#####OO### '((((((((((((((((((((()))))WWWWWWWWWWWWWVVVV//WWWWW:,.,WWWWW' :
;;;; , OOO##O;;;,.,;O#########O;,.,;;;O####OO###, ((((((((((((((((((()))(WWWWWWWWWWWWWWVVVVVVWWWWWWWWWWWWW' '
`;;' ,;; OOO##OO;;;;OOO(???????)OOO;;;;OO####OO###%, ((((((((((((((((()))(WWWWWWWWWWWWWVVVVVVVWWWWWWWWWWWW'
`\ ;;; `OOO#####OOOO##\?????/##OOOO#######O####%O@a
(((((((((((((())(()(WWWWWWWWW.VVVVVVVWWWWWWWWWWW:'
\,`;' `OOO####OOO######;######OOO###########%O###, ((((((((())) ()(WWWWWW.VVVVVVV'WWWWWWW'' .,,. .,,.
.,\ `OO####OO"#####;#####"OO##########%oO###O#; ((((())) ((WW,VVVVVVVVV'WWWWWWWWW :XXXX,XXXX:
,;;;; \ .::::OO##OOOaaa###aaaOOO#######',;OO##OOO##;, WVVVVVVVVVV'WWWWWWWW:' 'XXXXXXXXX'
.;;'' \:::.OOaa`###OO#######OO###'::aOO.:;;OO###OO;::. .,,. .,,. VVVVVVVVV'WWWWWWWWWW ':XXXXX:'
' .::\.OO####O#::;;;;;;;;;;;;::O#O@OO.::::::::://::
:XXXX,XXXX: .WVVVVVVV'WWWWWWWWWWWW 'XXX'
.:::.O\########O#O::;;;::O#OO#O###@OO.:;;;;;;;;//:, 'XXXXXXXXX' .WWW''''',WWWWWWWWWWWW: ':'
.:/;:.OO#\#########OO#OO#OO########@OO.:;;;;;;;;;//: ':XXXXX:' (())))WWWWWWWWWWWWWWWWW'
.://;;.OO###\##########O#############@OO.:;;;;;;;;//:. 'XXX' ((())))))WWWWWWWWWWWWWW'
;//;;;;.O'//;;;;;;\##################@OO.:;;;;;;;;//:.. ':' ((()))))))))WWWWWWWWWWW'
;//:;;;;:.//;;;;;;;;;#################@OO.:;;;;;;;;;//..
()WWWWWW))))))))))))))))
;;//:;;;:://;;;;;;;;;################@OO.:/;;;;;;;;;//.. :WWWWWWWWW)))))))))))))) .,,. .,,.
`;;;;;:::::::ooOOOoo#\############@OOO.;;//;;;;;;;;;//.o, WWWWWWWWWWW)))))))WWWWW. :XXXX,XXXX:
.;,,,.OOOOO############\#######@OOO.;;;//;;;;;;;;;;//;.OO, :WWWWWWWWWW')))))WWWWWWWW. 'XXXXXXXXX'
//;;.oO##################@\OOO.;;;;;;;;;;;;;;;;;;;;//;.oO#O, WWWWWWWWWW' 'WWWWWWWWWWWW ':XXXXX:'
//;;;;O##############@OOO=;;;;//;;;;;;;;;;;;;;;;;;;//;.oO##Oo
.,,:WWWW:,WWWWWWWWW' 'WWWWWWWWWWW 'XXX'
//::;;O#########@OOOOO=;;;;;;;//;;;;;;;;;;;;;;;////;.oO####OO ,WWWWWWWWWWWWWWWWWW' 'WWWWWWWWW ':'
.n.n.n.n`;O########@OOOOO=;;;;;;;;;;///;;;;////////';oO########OO ,WWWWWWWWWWWWWWWWWW' 'WWWWWWWW,
.%%%%%%%%%,;;########@=;;;;=;;;;///////////////':::::::::.a######@ WWWWWWW' '':WWW:' 'WWWWWWWW
/%%%%%%%%%%.;;;;""""=:://:::::::::::::::::\::::::::::::://:.####@' .WWWWWWW' .WWWWWWWWW
/%%%%%%%%%//.;' =:://:::::::::::::::::::\::::::::::://:.###@'
''W'W'WW ,WWWWWWWWW' .,,. .,,.
/%%%%%%%%//' =:://::::::::;:::::::::::\:::::::://:.##@' '' ,WWWWWWWW' :XXXX,XXXX:
/%%%%%%/ =:://:::;;:::::::::::::::\::::::::' .,,. .,,. .WWWWWW:' 'XXXXXXXXX'
'''' '''''' ''''''''''''''''\'''' :XXXX,XXXX: .WWWWWWW' ':XXXXX:'
\ 'XXXXXXXXX' WWWWWW' 'XXX'
':XXXXX:' WWWWW' ':'
'XXX' WWWW.
':' 'WWWWW,
'' ''
o Definition (ISO)
o Method and Technologies for converting data to and
from graphics devices via a computer
o Computer Graphics is the most versatile and powerful
means of communication between a computer and a
human being.
o A picture is worth than thousand words.
Computer
Generative Computer Graphics (GCG)
Graphics
Picture Analysis
Image Processing (IP)
Picture Processing
Picture Synthesis
GCG
Model Picture
IP
Picture Analysis
Application
Application Graphics
Data
Program System
Structure
o Output device
n Graphics diplay, printer, plotter,etc.
o Input device
n Mouse, lighth pen, track ball, etc.
o Interactive device
n Graphics console, graphics tablet, head mounted display,
etc.
…
… (Display commands) Interface to
MOVE host computer
10
15
(interaction data)
LINE Display
100 processor
25
CHAR
LU CRT
CY
LINE
… Stylus
…
JMP
Display
processor
CRT
Vertical and
Horizontal cursor
thumbwheels
Keyboard
Display Keyboard
00000000000000000000000001000000
processor Data input
00000000000000000000000001000000
00000000000000000000000111110000
00000000011000000001111111111111
00000000111100000000000111110000
00000011111111000000000001000000 CRT
00001111111111110000000001000000
00111111111111111100000000000000
00011111111111111000000000000000
00011111111111111000000000000000
00011111111111111000000000000000
00000000000000000000000000000000
Application
Application Graphics
Data
Program System
Structure
o geometric data
o non-geometric data
A’ B’’ C’ B’’ B’
A’’ A’
A B C ……
Database
OBJ
F1 F2 … Fk
E1 E2 … En … Em
V1 V2 … Vr
Point (x1,y1)
- a pair of x and y
coordinates
vertex
Line
- a sequence of points
Node
Polygon
- a closed set of lines
Spatial Attributes
Descriptive Attributes
P4 P3
P2
P1
P7
P8
P5 P6
s
t
Solid
Z Z
sweep
sweep
X
Y
CSG
Based
CSG
Sweep Spatial
Based Decomp.
B-Rep.
B-Rep.
Based
Application
Application Graphics
Data
Program System
Structure
o Definition:
o Interface between application software and graphics
hardware system
o Fundamentals
o Output primitives
o Primitive aspects
o Primitive attributes
o Output model
o Coordinate systems and clipping
o Input primitives
o Input model
o Storage
o Core - 1977
o GKS (Graphical Kernel System) - 1985
o X-Window - 1986
o GKS-3D - 1988
o PHIGS (Programmers Hierarchical Interface Graphics
System) - 1989
o CGI (device interface)
o CGM (metafile)
o CGRM (Computer Graphics Reference Model) - 1992
o IGES (Initial Graphics Exchange Specification) - 1980
o OpenGL (Open Graphics Library) - 1992
o DirectX
See CGI Historical Timeline, http://accad.osu.edu/~waynec/history/timeline.html
Graphics standard
Graphics Sys specification
implementors
Implemented graphics
system
Application
programmers
Graphics applications
Interactive graphics
Operators applications
Application program
Graphics system
Operating system
Operator
Constructive Level
Virtual Level
Workstation Workstation
Application Program
Graphics Kernel
Operating System
Graphics Other
Resources Resources
Application Program
OpenGL Motif
widget or similar GLUT
GLU
GLX, CGL, WGL
X, Win32, Mac OS GL
o Window tasks
For portability, there are
o User input no commands for these
o Complex shapes
o OpenGL Utility Library (GLU)
o Window system support
libraries: GLX / WGL / CGL
o OpenGL Utility Toolkit (GLUT)
o OpenGL User Interface (GLUI)
o OpenInventor
Application program
Direct sound
Direct X
Direct input
Direct 3D
……..
Windows system
1. 2D Transformations
2. Homogeneous coordinates
3. Particular transformations
4. 3D Transformations
5. Other transformations
x A’
x’ 1 0 Tx
= y
y’ 0 1 Ty A
1
O x
x’ Sx 0 x
= A’
y’ 0 Sy y A
O x
r θ
x’ cosθ -sinθ x
P
= r
y’ sinθ cosθ y φ
O x
x’ a b x
=
y’ c d y
o Translation
x
x’ 1 0 e
= y
y’ 0 1 f
1
x
a b c
w (X’, y’, w)
P’ = d e f y
g h i 1
(X’/w, y’/w, 1)
x’ x’/w
X
P’ = y’ = y’/w
w y
1
w’ 0 0 1 1
x’ x
o Rotation cosθ -sinθ 0
y’ = -sinθ cosθ 0 y
w’ 0 0 1 1
x’ x
o Translation 1 0 Tx
y’ = 0 1 Ty y
w’ 0 0 1 1
S T-1 (xR,yR)
Final Final
Position Position
(a) RT (b) TR
y
P1
Original 1 0 0
position
0 -1 0
P2 P3 0 0 1
x
P2’ P3’
Reflected
position
P1’
y
Original Reflected
position position -1 0 0
P2 P2’ 0 1 0
0 0 1
P3 P3’
P1 P1’
x
y Original
P3 y=x 0 1 0
position
1 0 0
0 0 1
P1
Reflected
P2 P1’ position
P3’
P2’
x
y = -x Original y
P3 0 -1 0
position
-1 0 0
P1 0 0 1
Reflected P2
position P1’
P3’ P2’
x
Reflected
y position -1 0 0
P2’
P1’ 0 -1 0
0 0 1
P3’
x
P3
Original
position
P1
P2
y y y
(1, 3)
(1, 2)
(0, 1) (1, 1) (2, 1) (3, 1)
(0, 1)
x x x
(0, 0) (1, 0) (0, 0) (1, 0) (0, 0)
1 SHx 0 1 0 0
0 1 0 SHy 1 0
0 0 1 0 0 1
P’ = TP
Ty
P(x, y, z)
x’ 1 0 0 Tx x
Tx Tz x
y’ 0 1 0 Ty y
=
z’ 0 0 1 Tz z z
1 0 0 0 1 1
x
x’ Sx 0 0 0 x
y’ 0 Sy 0 0 y
z
=
z’ 0 0 Sz 0 z
1 0 0 0 1 1
y y y
y
1 0 0 -xR Sx 0 0 0 1 0 0 xR
0 1 0 -yR 0 Sy 0 0 0 1 0 yR
T= S= T-1 =
0 0 1 -zR 0 0 Sz 0 0 0 1 zR
0 0 0 1 0 0 0 1 0 0 0 1
P’ = T-1STP
r
θ r
P(x,y,z)
x
cosθ -sinθ 0 0
sinθ cosθ 0 0 z
Rz =
0 0 1 0
0 0 0 1
y y
z x z x
x’ = x x’ = x cosθ + z sinθ
y’ = y cosθ - z sinθ y’ = y
z’ = y sinθ + z cosθ y’ = -x sinθ + z cosθ
1 0 0 0 cosθ 0 sinθ 0
0 cosθ -sinθ 0 0 1 0 0
Rx = Ry =
0 sinθ cosθ 0 -sinθ 0 cosθ 0
0 0 0 1 0 0 0 1
y
θ
u
(x1, y1, z1)
x
4. R-1 x
5. T-1 z
1 0 0 -x1
(x2, y2, z2)
0 1 0 -y1
T=
u u = (a, b, c) 0 0 1 -z1
(x1, y1, z1)
0 0 0 1
x
y y
(0, b, c) = u'
u = (a, b, c)
φ
(0, 0, 1) = uz
x x
d
a
u'' = (a, 0, d)
uy
(0, 0, 1) = uz
x x
d
a
z u'' = (a, 0, d) z
cosθ -sinθ 0 0
sinθ cosθ 0 0
Rz(θ) =
0 0 1 0
0 0 0 1
y y
x x
z z
o Tapering
x' = r(z) · x
y' = r(z) · y
z' = z
o Twisting
x' = x cos q (z) - y sin q (z)
y' = x sin q (z) + y cos q (z)
z' = z
o Bending
1. Motivation
2. Computer Graphics
3. Graphics Devices
4. Application Data Models
5. Graphics Systems
6. Conclusion
o Examples
o Definition
o Objectives
o Simulation
o Realism
o Interactivity
o Presence
.,,. .,,.
:XXXX,XXXX: .SSSSSSS'
.,;;;;;;;,. 'XXXXXXXXX' .SSSSSSSS,WW:, .''':,.
,;;;;;;;,/;;;; ':XXXXX:' .SSSSSSSSSS:WWW:, '::,
.,aa###########@a;;;;;/;;;,//;;; 'XXX' .SSSSSSSSS,WWW<*>WW '::, '////
..,,,.,aa##################@a;//;;;,//;;;
':' SSSSSSSSSSSS'WWWWWWD '::,////
,;;;;;;;O#####OO##############OOO###a,/;;;;' ,. SSSSSSS(((SSSWWWWW' ,WW//:.'.W.
.;;//,;;;O####OOO##########OOO####OOO#####a' ,((() 'SSSSSS(((WWWWWWWWWW) //'W,:WWWW'
.;;/,;;/;OO##OO#######################OOO####. ,(((((() 'SSSSSS((WWWWWWWWWW) // 'WWW,WWW
;;;/,;;//OO#######OOO###########OOO###########. .,(((((((()) 'SSSSWWWWWWWWWWW' // .WWWWW:,
`;;//,;,OOO#########OO#########OO##############.
.,((((((((((())), SSWWWWWWWWWW' // ,WWWW' ':,
;. ``````OOO#####;;;;;;OO#####OO;;;;;;######O####. .,((((((((((((((())))),.,,,,WWWWWWWWWW:, // ,WWWWW' ':
.;;, OOO###O;;' ~`;##OOOOO##;' ~`;;O#####OO### '((((((((((((((((((((()))))WWWWWWWWWWWWWVVVV//WWWWW:,.,WWWWW' :
;;;; , OOO##O;;;,.,;O#########O;,.,;;;O####OO###, ((((((((((((((((((()))(WWWWWWWWWWWWWWVVVVVVWWWWWWWWWWWWW' '
`;;' ,;; OOO##OO;;;;OOO(???????)OOO;;;;OO####OO###%, ((((((((((((((((()))(WWWWWWWWWWWWWVVVVVVVWWWWWWWWWWWW'
`\ ;;; `OOO#####OOOO##\?????/##OOOO#######O####%O@a
(((((((((((((())(()(WWWWWWWWW.VVVVVVVWWWWWWWWWWW:'
\,`;' `OOO####OOO######;######OOO###########%O###, ((((((((())) ()(WWWWWW.VVVVVVV'WWWWWWW'' .,,. .,,.
.,\ `OO####OO"#####;#####"OO##########%oO###O#; ((((())) ((WW,VVVVVVVVV'WWWWWWWWW :XXXX,XXXX:
,;;;; \ .::::OO##OOOaaa###aaaOOO#######',;OO##OOO##;, WVVVVVVVVVV'WWWWWWWW:' 'XXXXXXXXX'
.;;'' \:::.OOaa`###OO#######OO###'::aOO.:;;OO###OO;::. .,,. .,,. VVVVVVVVV'WWWWWWWWWW ':XXXXX:'
' .::\.OO####O#::;;;;;;;;;;;;::O#O@OO.::::::::://::
:XXXX,XXXX: .WVVVVVVV'WWWWWWWWWWWW 'XXX'
.:::.O\########O#O::;;;::O#OO#O###@OO.:;;;;;;;;//:, 'XXXXXXXXX' .WWW''''',WWWWWWWWWWWW: ':'
.:/;:.OO#\#########OO#OO#OO########@OO.:;;;;;;;;;//: ':XXXXX:' (())))WWWWWWWWWWWWWWWWW'
.://;;.OO###\##########O#############@OO.:;;;;;;;;//:. 'XXX' ((())))))WWWWWWWWWWWWWW'
;//;;;;.O'//;;;;;;\##################@OO.:;;;;;;;;//:.. ':' ((()))))))))WWWWWWWWWWW'
;//:;;;;:.//;;;;;;;;;#################@OO.:;;;;;;;;;//..
()WWWWWW))))))))))))))))
;;//:;;;:://;;;;;;;;;################@OO.:/;;;;;;;;;//.. :WWWWWWWWW)))))))))))))) .,,. .,,.
`;;;;;:::::::ooOOOoo#\############@OOO.;;//;;;;;;;;;//.o, WWWWWWWWWWW)))))))WWWWW. :XXXX,XXXX:
.;,,,.OOOOO############\#######@OOO.;;;//;;;;;;;;;;//;.OO, :WWWWWWWWWW')))))WWWWWWWW. 'XXXXXXXXX'
//;;.oO##################@\OOO.;;;;;;;;;;;;;;;;;;;;//;.oO#O, WWWWWWWWWW' 'WWWWWWWWWWWW ':XXXXX:'
//;;;;O##############@OOO=;;;;//;;;;;;;;;;;;;;;;;;;//;.oO##Oo
.,,:WWWW:,WWWWWWWWW' 'WWWWWWWWWWW 'XXX'
//::;;O#########@OOOOO=;;;;;;;//;;;;;;;;;;;;;;;////;.oO####OO ,WWWWWWWWWWWWWWWWWW' 'WWWWWWWWW ':'
.n.n.n.n`;O########@OOOOO=;;;;;;;;;;///;;;;////////';oO########OO ,WWWWWWWWWWWWWWWWWW' 'WWWWWWWW,
.%%%%%%%%%,;;########@=;;;;=;;;;///////////////':::::::::.a######@ WWWWWWW' '':WWW:' 'WWWWWWWW
/%%%%%%%%%%.;;;;""""=:://:::::::::::::::::\::::::::::::://:.####@' .WWWWWWW' .WWWWWWWWW
/%%%%%%%%%//.;' =:://:::::::::::::::::::\::::::::::://:.###@'
''W'W'WW ,WWWWWWWWW' .,,. .,,.
/%%%%%%%%//' =:://::::::::;:::::::::::\:::::::://:.##@' '' ,WWWWWWWW' :XXXX,XXXX:
/%%%%%%/ =:://:::;;:::::::::::::::\::::::::' .,,. .,,. .WWWWWW:' 'XXXXXXXXX'
'''' '''''' ''''''''''''''''\'''' :XXXX,XXXX: .WWWWWWW' ':XXXXX:'
\ 'XXXXXXXXX' WWWWWW' 'XXX'
':XXXXX:' WWWWW' ':'
'XXX' WWWW.
':' 'WWWWW,
'' ''
o Definition (ISO)
o Method and Technologies for converting data to and
from graphics devices via a computer
o Computer Graphics is the most versatile and powerful
means of communication between a computer and a
human being.
o A picture is worth than thousand words.
Computer
Generative Computer Graphics (GCG)
Graphics
Picture Analysis
Image Processing (IP)
Picture Processing
Picture Synthesis
GCG
Model Picture
IP
Picture Analysis
Application
Application Graphics
Data
Program System
Structure
o Output device
n Graphics diplay, printer, plotter,etc.
o Input device
n Mouse, lighth pen, track ball, etc.
o Interactive device
n Graphics console, graphics tablet, head mounted display,
etc.
…
… (Display commands) Interface to
MOVE host computer
10
15
(interaction data)
LINE Display
100 processor
25
CHAR
LU CRT
CY
LINE
… Stylus
…
JMP
Display
processor
CRT
Vertical and
Horizontal cursor
thumbwheels
Keyboard
Display Keyboard
00000000000000000000000001000000
processor Data input
00000000000000000000000001000000
00000000000000000000000111110000
00000000011000000001111111111111
00000000111100000000000111110000
00000011111111000000000001000000 CRT
00001111111111110000000001000000
00111111111111111100000000000000
00011111111111111000000000000000
00011111111111111000000000000000
00011111111111111000000000000000
00000000000000000000000000000000
Application
Application Graphics
Data
Program System
Structure
o geometric data
o non-geometric data
A’ B’’ C’ B’’ B’
A’’ A’
A B C ……
Database
OBJ
F1 F2 … Fk
E1 E2 … En … Em
V1 V2 … Vr
Point (x1,y1)
- a pair of x and y
coordinates
vertex
Line
- a sequence of points
Node
Polygon
- a closed set of lines
Spatial Attributes
Descriptive Attributes
P4 P3
P2
P1
P7
P8
P5 P6
s
t
Solid
Z Z
sweep
sweep
X
Y
CSG
Based
CSG
Sweep Spatial
Based Decomp.
B-Rep.
B-Rep.
Based
Application
Application Graphics
Data
Program System
Structure
o Definition:
o Interface between application software and graphics
hardware system
o Fundamentals
o Output primitives
o Primitive aspects
o Primitive attributes
o Output model
o Coordinate systems and clipping
o Input primitives
o Input model
o Storage
o Core - 1977
o GKS (Graphical Kernel System) - 1985
o X-Window - 1986
o GKS-3D - 1988
o PHIGS (Programmers Hierarchical Interface Graphics
System) - 1989
o CGI (device interface)
o CGM (metafile)
o CGRM (Computer Graphics Reference Model) - 1992
o IGES (Initial Graphics Exchange Specification) - 1980
o OpenGL (Open Graphics Library) - 1992
o DirectX
See CGI Historical Timeline, http://accad.osu.edu/~waynec/history/timeline.html
Graphics standard
Graphics Sys specification
implementors
Implemented graphics
system
Application
programmers
Graphics applications
Interactive graphics
Operators applications
Application program
Graphics system
Operating system
Operator
Constructive Level
Virtual Level
Workstation Workstation
Application Program
Graphics Kernel
Operating System
Graphics Other
Resources Resources
Application Program
OpenGL Motif
widget or similar GLUT
GLU
GLX, CGL, WGL
X, Win32, Mac OS GL
o Window tasks
For portability, there are
o User input no commands for these
o Complex shapes
o OpenGL Utility Library (GLU)
o Window system support
libraries: GLX / WGL / CGL
o OpenGL Utility Toolkit (GLUT)
o OpenGL User Interface (GLUI)
o OpenInventor
Application program
Direct sound
Direct X
Direct input
Direct 3D
……..
Windows system
1. Core
2. GKS
1. Functional levels
2. Graphics primitives
3. Coordinate systems
4. Window-viewport transformations
5. Graphics transformations
6. Graphics segments
3. Conclusion
Graphics model
5. Space dimension
CORE: 3D; GKS: 2D, 3D
6. Coordinate system
Application program transforms NDC to WC
GKS works on real world coordinate
7. Device control
CORE identifies the output device
GKS: workstations with associated list of attributes and
window/viewport pair.
Elements of Computer Assisted Graphics 4
GKS
o Graphical Kernel System
1984 (’85) GKS 2D
1988 GKS-3D
Application Program
Graphics Kernel
Operating System
Graphics Other
Resources Resources
Constructive Level
Virtual Level
Workstation Workstation
Attributes: P1
color: p x R + q x G + s x B
2. Polymarker
Attributes:
type: . + x * o
dimension: * * *
height:
expansion
Text
4. Fill-area
Text
5. Cell-array
World Normalized
20
coordinate device
system coordinate
system
30 x x
Data
Translat
e
Scale
Tooth
Data
Segment transformations
WC NDC PDC
Call
Data input
function
return Get
data
2. Sample mode
call
Call Maintain Data input
function data
return
3. Event mode
Application System
program
Data input
call
Wait for Wait Queue
event
event state data
return
call FIFO
Get Maintain
data data
return
Data
queue
xL
yV
yS
xS xV Center of
V
zV Projection,
U Viewer’s
N Position
xwc
ywc
window pixel
viewport
Window definition Viewport definition Window’s content Scan conversion onto the
in projection plane in projection plane inside the viewport raster screen
o OpenGL 1, Direct3D 2
o Retained-mode (RM)
o The scene (lines, shapes, images,…) is kept in memory
o The actual drawing is performed once, using the stored model
o The application simply adds and removes drawing primitives
o Offers abstraction
Immediate-mode Retained-mode
Application
Update
Application Build scene
Drawing
commands Scene Graphics library
Update
Graphics library Drawing
commands Scene
Display
Display
Fragment processing
Framebuffer image
Fragment processing
Framebuffer image
Fragment processing
Framebuffer image
wy cz
wz cx
Fragment processing
Framebuffer image
y y
z z
Rasterization
Fragments
Fragment processing
Framebuffer image
(x2, y2)
z
(x1, y1)
1. Output devices
o Hardcopy technology
o Display technology
o Raster system architectures
2. Input devices
Application
Application Graphics
Data
Program System
Structure
o Output device
n Graphics display, printer, plotter etc.
o Input device
o Logical
n locator, stroke, string, valuator, choice, pick
o Physical
n mouse, trackball, joystick, scanner, keyboard, etc
o Interactive device
n Graphics console, graphics tablet, head mounted display, etc.
pen carriage
Pen plotters include a
microcontroller
o Accepts graphics commands:
draw line, move, draw circle,
etc.
o Decomposes the output
primitives into incremental pen
movements:
∆x, ∆y, z, ∆u etc.
Color plotter
Multiple passes for fundamental colors
Colors: black, cyan, magenta, and yellow toners
One pass, multiple heads
Electric contacts
Bath of suspended
toner particles
Paper
paper movement
Selenium coated
drum
Deflection
Laser system
Laser beam
Scan line
Paper wrapped
around drum
Track
Ink jets
carriage
Horizontal
Focusing Deflection
System Plate
Heating
Filament
Electron Beam
Cathode
Control Accelerating Vertical
Grid System Deflection
Plate
Phosphor-
Coated
Color: Screen
Beam Penetration
Shadow Mask
Electron Gun
Screen
Phosphor
Green
beam Red beam
o Sharpness
energy
1 spot size inter-dot distance dot size, spot
dot pitch size
0.5 ~ 0.6
distance
electron beam
Input
Refresh
memory (Display file, frame buffer)
Flood Gun
Screen
Storage grid
Collector grid
Register DAC
1
Register
N
0 1 0 2N DAC
2
N=3 2N Levels
0 DAC Blue
1 DAC Green
0 DAC Red
N=3 2N Levels
Look-up tables
W
2W intensity levels
2N at a time
1010
2N entries 10
W=4
0 1 0
2
2W DAC
N=3 2N levels
Viewing
direction
Liquid-
Vertical Vertical Horizontal Horizontal Reflective
crystal
polarizer grid wires grid wires polarizer layer
layer
Color cell
Color Filter
Liquid Crystal
TFT
Viewing
direction
o CRT projector
o LCD projector
Realitate Virtuala 39
HMD - examples
Realitate Virtuala 40
HMD – Virtual glasses
Realitate Virtuala 41
HMD – Virtual glasses
Realitate Virtuala 42
HMD – Virtual glasses
Realitate Virtuala 43
Display-uri mari bazate pe monitoare
Realitate Virtuala 44
Binocular Omni-Orientation Monitor (BOOM)
Realitate Virtuala 46
Display-uri de mari dimensiuni
o Display grafic care afiseaza o scena virtuala destinata
vizualizarii simultane a mai multor utilizatori amplasati in
vecinatatea display-ului
n Imagini monoscopice
n Imagini stereoscopice
o Bazate pe monitoare
o Bazate pe proiectoare
Realitate Virtuala 47
Display-uri mari bazate pe monitoare
o Alternativa este folosirea
monitoarelor multiple
amplasate adiacent
o Probleme apar la
simularea la viteze mari
cand apar discontinuitati
intre imaginile de pe
monitoarele adiacente
Realitate Virtuala 48
Display-uri mari bazate pe proiectoare
Realitate Virtuala 49
Display-uri mari bazate pe proiectoare
Realitate Virtuala 50
Workbench
CPU Peripheral
devices
System bus
CPU Peripheral
devices
System bus
System Video
Monitor
memory controller
o System memory:
n Application program
n Graphics package
n Operating system Peripheral
CPU
devices
o Display processor:
n Raster operations
n Scan conversion
n Double-buffering
n I/O transfer on the System bus
system bus
Display System
processor memory
Display
Frame Video Monitor
processor
buffer controller
memory
o Cache memories
o Video RAM (VRAM)
(read out all pixels on a scan
line in one cycle)
Display Peripheral
CPU processor devices
System bus
o Text
o Graphic Tablet
a) Active tablet, passive pen.
b) Acoustic active pen, tablet with
microphones.
q 3-dimensional pen-style
haptic device that "makes it
possible for users to touch and
manipulate virtual objects
q 3D Touch-enabled Modeling for
Product Design
q The position and orientation of
the pen are tracked through
encoders in the robotic arm.
q Three degrees of force, in the
x, y and z, direction are achieved
through motors that apply
torques at each joint in the
robotic arm
ex. PHANTOM Desktop
References
http://www.engineersgarage.com/articles/touchscreen-technology-
workinghnology
xL
yV
yS
xS xV Center of
V
zV Projection,
U Viewer’s
N Position
xwc
ywc
window pixel
viewport
Window definition Viewport definition Window’s content Scan conversion onto the
in projection plane in projection plane inside the viewport raster screen
8 neighbors 4 neighbors
x1 ∆x x2 x
Case 1: 0<m<1
Xi+1 = xi + 1
yi+1 = yi + m
Case 2: 1<m
yi+1 = yi + 1
xi+1 = xi + 1/m
m <1
1. Compute a decision
variable di=f(Pi, di-1)
NE
2. Depending on the di value yi + 1
chose the next position E n
or NE
Q
Pi s
yi
E
xi xi + 1
xi xi + 1
di = ∆x(s-n) = 2∆y(xi+1)-2∆xyi+∆x(2b-1)
= 2∆yxi -2∆xyi +[2∆y+∆x(2b-1)]
= 2∆yxi -2∆xyi + Const
di = 2∆yxi -2∆xyi + Const
if di < 0 then E(xi+1,yi)
if di ≥ 0 then NE(xi+1,yi+1)
d0 = 2∆y-2∆x
NE
yi + 1
M F(x,y)=0
Q
yi
E
xi xi + 1
F(x,y)=x∆y-y∆x+n∆x
NE if F(xi+1, yi+1/2)<0
x
E if F(xi+1, yi+1/2)>0
xi xi + 1
y
P2(x2,y2)
P2’(x2,y2)
P1(x1,y1)
P1’(x1,y1) P’
y
o Removing the stairstep
appearance of a line
o Staircase for raster effect
o Need some compensation in
line-drawing algorithm for the
raster effect
(x-xc)2 + (y-yc)2 = r2
y = yc ± sqrt((r2) - (x-xc)2) r
yc
xc
x = xc + r cosθ
y = yc + r sinθ
r
θ
yc
xc
y y
(-y, x) (y, x)
x x
r2 = radius * radius;
raster.setPixel(pix, xCenter, yCenter + radius);
raster.setPixel(pix, xCenter, yCenter - radius);
for (x = 1; x <= radius; x++) {
y = (int) (Math.sqrt(r2 - x*x) + 0.5);
raster.setPixel(pix, xCenter + x, yCenter + y);
raster.setPixel(pix, xCenter + x, yCenter - y);
raster.setPixel(pix, xCenter - x, yCenter + y);
raster.setPixel(pix, xCenter - x, yCenter - y);
}
}
Therefore:
if F(M) < 0, next point P(xi+1,yi+1) = E(xi+1,yi)
otherwise next point P(xi+1,yi+1) = SE(xi+1,yi-1)
x
Initial decision variable value:
d0 = F(0, R)= 5/4 - R
o Scan conversion
o Seed filling
1 2 3 4 5 6 7 8 9 10 11 12
o Run-length encoding
(intensity, run length)…○4●4○4●9……
o Cell-organization
o Frame buffer
o Flexibility 2
A
3
D
Edge list 1: Edge list 2: Edge list 3:
1 2 3 1 2 3 1 2 3
BC ← b BC BC BA ← b BA ← b BA BD ← b BD ← b BD ← b
BA BA ← b BA BC BC BC BA BA BA
BD ← e BD BD ← b BD ← e BD BD ← b BC ← e BC BC
CD CD ← e CD CD CD ← e CD CD CD ← e CD
AD AD AD ← e AD AD AD ← e AD AD AD ← e
0 30
0 7 1 8 0 15
0 1 1 2 0 20 1 2 0 5
Complex object B
A
OR
C
A B
1 12 11 2 3 10 9 4 5 8 7 6
1 2 3 4
1 2
1 2 3 4
1 2,3 4,5 6
1 2 3 4
1 2,3 4,5 6
4 4
3.5
3 3
2.5
2 2
1.5
1 1
0 1 2 3 4 5 6 0 1 2 3 4 5 6
8
P5
6 P3
Edge sorting on
y coordinate
4
P4
2
P2
P1
0 2 4 6 8 10
Scan line 4:
2 P4
x45+2∆x45, ∆x45, ∆y45 -2
x51+2∆x51, ∆x51, ∆y51 -2
P2
P1 x23+∆x23, ∆x23, ∆y23 -1
0 2 4 6 8 10 x34+∆x23, ∆x34, ∆y34 -1
P1
P3 P3
P2 P2 P4
P6 P6
P7
P4
P1
P7
P8 P8
P1
P3 P3
P2 P2 P4
Fence
P4
P1
P7
P8 P8
flag flag
in out
flag flag
in out
y y
x x
y y
Firt 3 2
course
ID
5 4
x x
3 2
5 4
A
A
Figure 1a Figure 1b B
E
D
B
D C
C
E
Elements of Computer Assisted Graphics 30
Questions and proposed problems
4. Explain the generation of the edge list if the scan line is moving
upward, instead downward.
5. Explain why the relationship between real polygon point, scan line and
pixel position is important?
6. How big could be the polygon rendering error?
7. Explain the Ordered Edge List algorithm on Figure 1a.
8. Explain the Ordered Edge List algorithm on Figure 1b.
9. Explain the Ordered Edge List algorithm on Figure 1a and b, if the scan
line is moving upward.
10. Explain how the Ordered Edge List algorithm depends on the upward
and downward movement of the scan line?
11. Why would the seed filling algorithm be disadvantageous?
12. What is the worst case for the recursive seed filling algorithm?
xL
yV
yS
xS xV Center of
V
zV Projection,
U Viewer’s
N Position
xwc
ywc
window pixel
viewport
Window definition Viewport definition Window’s content Scan conversion onto the
in projection plane in projection plane inside the viewport raster screen
Viewport
yvmax
ywmin
yvmin
Window definition: (xwmin, xwmin, xwmax, ywmax) Viewport def: (xvmin, xvmin, xvmax, yvmax)
yw
(-60.5, 82.5) (41.25, 82.5)
1
Window 0.87
Viewport
0.50
0 xw
1 ymax
1 xmax
0 1
WC NDC PDC
y P8 y
P2
P7 Window Window
ywmax ywmax
P3
P9 P3 P4 P1 P4 P1
P’9
P10
P’10
P5 P5
ywmin ywmin
P6 P’6
y
C D
ywmax
B
A
ywmin
xwmin xwmax x
ywmax B
D
A C
ywmin
xwmin xwmax x
Basic Idea
n Encode the line endpoints
Region outcodes:
1000
D
1001 C
1010 S
B G H R
F
A 0000
0001 Q 0010
E P
N
M
0101 0100 0110
P1
tline
V4 tedge V3
P0
V1 V2
o Outside Inside
clipping clipping
rectangle rectangle
Edge Ei
PEi
P1
Ni ∙ [Pi(t) – PEi] = 0
Ni
P1
φ
t=1
N
PE P1 P1
N
φ Line 2 t=1 t=1
PL PL
PL PE Line 1
P0 Line 3
t=0
P0 PL
t=0
PE
Clipping rectangle
PE
P0
t=0
E1 L1
P Q E2
B
n
Computing normal vector of the edge: C
1. Compute the normal vector of the plane
N = AB x BC
(cross product of two consecutive edges)
2. Normal vector of the edge
n = AB x N
(cross product of the edge and normal
vector of the plane)
D
E1 L3
Q E2 L1 E3
P B
E
P5
P3
Cyrus-Beck algorithm:
o Simplifies the Cyrus-Beck algorithm for the particular case of clipping window as
an horizontal rectangle:
2. The dot product Ni ∙ (P0 – PEi) determining whether the endpoint P0 lies
inside or outside a specific edge, reduces to the directed horizontal or
vertical distance from the point to the edge.
If dx >0, the line moves from left to right and is PE for the left edge, PL
for the right edge, and so on.
o General definition:
n Sequence of vertices with implicit relationships
n By clipping: 1 polygon (v1, v2, …., vn) ®
p polygons (A11, A12, …, A1k; …Ap1, Ap2, …,Apq)
o Display:
n set of points
n set of lines (wire-frame)
n closed multicolor polyline
n set of polygons
n filled polygons
Original
Polygon
I
P S P
S
P S
I
P S
Window
3
Window
2 3 1’ 2’
2’ (8’)
2 1’
1 4 3’
5 4’
1 4
3’ 5’
6 6’
5’ 7’
6 4’
7
5 (a) (b)
Before Clipping
After Clipping
o 4 cases:
2
a) out - > in
b) in -> in
c) in -> out 1
d) out - > out
e) follow clip edge
4 3
2 2 2
2
1’ 1’ 1’ 1’
3’ 3 3
3
3’
2 2 2 2
1’ 1’ 1’ 1’
3 3’ 3 3’ 3 3’ 3
4 4 4
3’
4 4’ 4’ 4’
5 5 5
5’ 5’
2 2 2
1’
1’ 1 1’
3 3 3’ 3
3’ 3’ 4’
4 4 4’ 5
4’ 5 5
6 6 5’
5’ 5’
Final Result:
Continue from Nothing added. 2 unconnected
cached vertex and Finished polygons
direction
B A4 B4
A2 A3 A6 A5 B5
A7
A6
B4
A7
B2 A8 A9
A8
A9
B3 A10
A2 A3 C3 A6 A5 B5
A7
A6
B4
A7
B2 A8 A9
C4 A8
A9
B3 A10
A8
A9
A10
A8
A9
A10
A8
A9
A10
A8
A9
A10
A8
Entering vertex
Leaving vertex
A9
A10
Clipped polygons: A8
Polygon 1: C1, A2, A3, C2
Polygon2: C3, A7, A8, C4, B5 A9
A10
STRING1
All or none
text clipping
STRING2 STRING2
STRING1 ING1
All or none
character clipping
STRING3 TRING3
STRING4 STRING4
STRING1 STRING1
Clipping individual
character
Figure 1
E
B
P Q Q1 Q2
C D
Figure 2
A
A
b.
a.
Figure 3
c.
a. b.
Figure 4
a. b.
Figure 5
c.
a. B
A b. B
A
B
Figure 6
Figure 7
Figure 8
C
Projections
Viewing transformation
Remarks
xL
yV
yS
xS xV Center of
V
zV Projection,
U Viewer’s
N Position
xwc
ywc
window pixel
viewport
Window definition Viewport definition Window’s content Scan conversion onto the
in projection plane in projection plane inside the viewport raster screen
Parallel Perspective
Isometric Others
Parallel projection
Parallel projection rays. Convergence point at infinity.
Viewer’s position at infinity.
A
Projection Projection
plane plane
A’ A
A’
8
Center of B
Center of B B’
B’ projection
projection
Oblique
Direction of projection is different than the normal vector
Projection Projection
plane plane
A’ A’
B’ A B’
A n
n B
B
Front-elevation
Top-elevation
Projection plane is perpendicular
to the z axis
y
Side-elevation
Projection plane is perpendicular
to the x axis
Front-elevation
Side-
elevation
Axonometric
Isometric projection
Commonly used axonometric projection
Projetion plane normal (and direction of
projection) makes egual angles with each
principal axis
If the projection plane normal is (dx, dy,
dz), it requires that |dx|=|dy|=|dz|,
or ±dx= ±dy= ±dz
Isometric
Axonometric z
Isometric z
xp = x + z L1 cos φ
yp = y + z L1 sin φ
zp = 0
P(x,y,z)
z
xp 1 0 L1 cosφ 0 x
yp 0 1 L1 sinφ 0 y
=
zp 0 0 0 0 z
1 0 0 0 1 1
Cabinet projection
y y
Cavalier L L
L
L
β=45°, tgβ=1
z
z
L L
φ=45° φ=30°
x x
y
y
L L
Cabinet L/2 L/2
β=63.4°, tgβ=2 z
z L
L
φ=45° φ=30°
x x
Therefore:
P(x,y,z) u = z/(z+d)
xp = x – xz/(z+d) = x[1/(1+z/d)]
yp = y – yz/(z+d) = y[1/(1+z/d)]
zp = 0
z
Pp (xp, yp, 0) xp 1 0 0 0 x
x
yp 0 1 0 0 y
=
zp 0 0 0 0 z
P(x,y,z)
w 0 0 1/d 1 1
= [x/(1+z/d), y/(1+z/d), 0, 1]
One-point Two-point
perspective projection perspective projection
xL
yV
yS
xS xV Center of
V
zV Projection,
U Viewer’s
N Position
xwc
ywc
window pixel
viewport
Window definition Viewport definition Window’s content Scan conversion onto the
in projection plane in projection plane inside the viewport raster screen
V
yv
N
U zv
xv
Projection
plane
yw v
Pw
Pv=(xv,yv,zv)
Tv
n
u
zw xw
Pw = Tv + Pv = Tv + RvPv
xw xw xw
zw zw zw
(a) Original orientation of world and (b) Invert viewing (c) Translate viewing
viewing coordinate systems z axis origin to world origin
yw yw yw
yv
xv yv
xv
yv xv
zv
zv xw
xw xw
zw zv zw zw
(d) Rotate about world x axis (e) Rotate about the world (f) Rotate about the world
to bring viewing z axis into y axis to align z axis to align the two
the xz plane of the world system the two z axes viewing systems
v2 v1, v2
v
v1 u1, u2
v
Interpolator
u
u1 u u2
ui+1 = ui + ∆u
vi+1 = vi + ∆v
Pi Pn
P0
p 0 t1 - p 1 t0 p1 - p0
p(t) = +t (3)
t 1- t 0 t 1- t 0
p1 - p0
p(t + ∆t) = p(t)+ ∆t (4)
t 1- t 0
o Dezavantaje:
n Calculul punctelor de control al curbelor spline se face pe baza unor
constringeri de interpolare definite pentru punctele de control
n Sunt necesare informatii suplimentare (Ex. vectorii tangenta la capete)
Ref: Automatic Splicing for Hand and Body Animations Majkowska, A., Zordan, V. B., Faloutsos, P.
ACM SIGGRAPH/Eugorgraphics Symposium on Computer Animation (SCA) 2006
P(x,y,z)
n Triangulatie prin ultrasunete. Simplu dar mai putin precis decit senzorii
magnetici.
n Triangulatie optica. Sunt atasati emitatori pe obiectul urmarit. Doua camere
determina pozitia. Poate urmari mai multe puncte, fara a folosi cabluri.
n Costume de corp. Senzori care determina unghiurile din incheieturi sunt
inserati in tesatura hainelor.
n Obiecte cu comportament haotic. Exemple: nori, foc, apa, iarba, blana, etc.
2. Aliniere
Alinierea la orientarea medie a grupului
local
3. Coeziune
Deplasare spre pozitia medie a grupului
local
o Ref.: Craig Reynolds, Boids,
http://www.red3d.com/cwr/boids/ (1986).
Y
Y
x = x1 + t(x2-x1)
y = y1 + t(y2-y1) y t >1
P = (x, y)
t<0, before P1(x1, y1)
t=1 P2 = (x2, y2)
t=0, P=P1
0<t<1, get points 0< t <1
between P1 and P2
t=1, P=P2(x2, y2) t=0 P1 = (x1, y1)
t>1, after P2 t<0
x
Elements of Computer Assisted Graphics 5
Line related formulas
o Length = sqrt (x2 - x1)2 + (y2 - y1)2
o Midpoint, p3, between p1 and p2
p3 = ((x1 + x2) / 2, (y1 + y2) / 2))
o Two lines are perpendicular if:
m1 = -1/m2
cos(θ) = 0
dot product of related vectors is zero (u•v=0)
o Point P3 lays on the line P1P2 if:
Cartesian space, slope based definition:
y3 = mx3 + b, where m(P1,P2), b(P1,P2)
Affine space, parametric definition:
P3 = P1 + t(P2-P1), the system of equation on x, y (and z)
should have solution. The position depends on the t value
(<0, 0, 0..1, 1, 1<)
ux x
y y
u+v
v v
u u
x -v x
u-v
o Used for:
n Computing the length (Euclidean Norm) of a vector:
length(v) = ||v|| = sqrt(v • v)
n Computing the distance between two points P and Q:
v = Q – P, distance(P, Q) = length(v) = ||v|| = sqrt(v • v)
n Normalizing a vector, making it unit-length: v = v / ||v||
n Checking two vectors for orthogonality
u•v=0
n θ
v Q
P
u•v
_________
||w||=||u||cos(θ)=||u|| = u•v
||u||·||v||
u
n θ
θ v Q
P
w v
x1 x2 i j k i j k
v1 = y1 v2 = y2 v = v1xv2 = x1 y1 z1 v = x1 0 0
z1 z2 x2 y2 z2 0 y2 0
v2 y1 z2 – y2 z1 0
n3 v8 v7
v8 v7
v4 v3
n3
v4
v3 n2
n2
v6 n1 v6
v1 v2
n1 v1 v2
(x1, y1)
v = v1xv2 = x1 y1 0
x2 y2 0 v1
x
v
v = (x1 y2 – x2 y1) k
The cross product is a vector v along z, z
of module | x1 y2 – x2 y1|.
y C (x2, y2)
v2
B
θ (x1, y1)
v1
A
x
Elements of Computer Assisted Graphics 14
Area of a triangle
The triangle ABC has the area:
½ (x1-x2) (y1+y2) + y C (x2, y2)
½ (x2-x0) (y2+y0) +
½ (x0-x1) (y0+y1) = v2 (x1, y1)
B
½ (x1y1+x1y2-x2y1-x2y2 +
θ
x2y2+x2y0-x0y2-x0y0 + v1
x0y0+x0y1-x1y0-x1y1) = A
(x0, y0)
x
½ (x0y1-x1y0+x1y2-x2y1+x2y0-x0y2)
where x0, y0 = 0
S = ½ (x1y2-x2y1)
therefore
S = ½ |v1 x v2|
Moreover
v1x v2 = |v1| |v2| sinθ
u
c
v
n
a
n-1
O x
S = 1/2 Σi=0
(xiyi+1 – xi+1yi)
n-1
Pn-1
S = 1/2 Σi=0
(vi x vi+1)
(xn-1, yn-1) (x1, y1)
P1
P0
(x0, y0)
O x
E E
D
D B
B C
A
A
E E
D
D B
B C
P0
x
O
y1 z1 1 x1 z1 1
x y z 1 A= y2 z2 1 B=- x2 z2 1
x1 y1 z1 1 y3 z3 1 x3 z3 1
=0
x2 y2 z2 1
x3 y3 z3 1 x1 y1 1 x1 y1 z1
C= x2 y2 1 D=- x2 y2 z2
x3 y3 1 x3 y3 z3
((P - Q)•v
__________
Gives t=
w•v
((P - Q)•v
And the intersection point is Q+ _________ w
w•v
x1 y1 1
D = x2 y2 1
x3 y3 1 Q = (x2, y2) R = (x3, y3)
t=1
Discussion on the t: P2 = (x2, y2)
t=0, P=P1(x1, y1) 0< t <1
t=1, P=P2(x2, y2)
0<t<1, the P position t=0 P1 = (x1, y1)
between P1 and P2
t<0
P
B C
B
C
P
A A
P3
E E
5 D D P2
4
P1
1
P 3 P
2
B B
C C
B
C
A
A
E
E
D
D
B
B C
C
Q Q Q
n n n
P P
P
Г Г Г
If t = 0 then L(t) = L0
If t = 1 then L(t) = L1
Otherwise, L(t) is part way from L0 to L1
(L(t) - Q) • n = 0
(L0 + (L1 - L0)t – Q) • n = 0
t = [(Q - L0) • n] / [(L1 - L0) • n]
E1 L1
P Q E2
B
n
C
Elements of Computer Assisted Graphics 38
Line to polygon relationship
o Convex and concave polygons
o Triangulation
o Convex polygons
n Analyses the line to edges relationships
n Cyrus-Beck algorithm
(requires a convex polygon!)
D
E1 L3
Q E2 L1 E3
P B
E
P5
P3
Cyrus-Beck algorithm:
P5
P3
Cyrus-Beck algorithm:
P P
6
R
A
1 5
Q
0 P
B
C
2
3
4