Digital Media
Lecture 5: Vector  Graphics
Georgia Gwinnett College
School of Science and Technology
Dr. Jim Rowan
So far…
We have compared bitmapped graphics andvector graphics
We have discussed bitmapped images, somefile formats and some file compressiontechniques
Today we are going to talk in a bit more detailabout vector graphics
Later we will cover Color
Then 3D vector graphics
Vector Graphics…
An elegant way to construct digital imagesthat
can have a compact representation
are scalable
provdes access to the objects
And mandatory for 3-D modeling
But first:
Coordinate systems
Coordinate Systems
Bitmapped pixel coordinates (integer)
4,0
4,1
4,2
4,9
3,0
3,1
3,2
3,9
0,0
0,1
0,2
0,9
x
y
0
1
2
3
4
0
1
2
3
4
9
Coordinate Systems
Bitmapped pixel coordinates (integer)
A
E
C
D
x
y
0
1
2
3
4
0
1
2
3
4
9
B
5
6
A?= ( , ) B?= ( , ) C?= ( , ) D?= ( , ) E?= ( , )
Coordinate Systems
Vector graphics coordinates (real values)
A point is defined by its x and y coordinate
0
1
2
3
1
2
x
y
(1.41, 1.74)
(x,y)
They can be fractional
They can be negative
Vector graphics coordinates (real values)
A displacement (distance between points or movement from onepoint to another) can be defined by a pair of points
0
1
2
3
1
2
x
y
(1.41, 1.74)
point 1
(3.12, 0.95)
displacement from point 1 to point 2?
displacement =
         = [(x2 - x1), (y2 - y1)]
         = (3.12 - 1.41, 0.95 - 1.74)
         = (1.71,-0.79)
point 2
Coordinate Systems
Vectors have magnitude (length) and direction
     This vector goes down 0.79 and to the right 1.71 (1.71 , -0.79)
0
1
2
3
1
2
x
y
(1.41, 1.74)
point 1
(3.12, 0.95)
point 2
Vectors
Why “vector graphics?”
This is a grandfathered term
It comes from the CRT days when displayscould be directly “steered” by their programs
A program passed a vector to the display andthe beam would move to the next pointdrawing a line
Next:
Absolute vs Window
coordinate systems
Absolute vs Window
Applications render images inside of awindow
They know where stuff is in the window
But not where the window is
They deal with relative coordinates
The Operating system
Keeps up with the window
It deals with absolute coordinates
Absolute vs Window
absolute
coordinates: measured back to the upperleft hand corner of the screen
relative (to the window)
coordinates measurement back to the upperleft hand corner of the window
to convert relative to absolute, addthe relative coordinates to theabsolute coordinate of the upper lefthand corner of that window
absolute&relativePosition.tiff
The bounding box
It’s a way to locate an object in space
what point is used to place an object?
the center of the object’s mass?
the upper left corner?
the lower right corner?
images can be contained inside a“bounding box” which is the smallestbox that contains all the points found inan object
Bounding boxes;relative and absolute coordinates
x
y
(0,0)
window 1
window 1
desktop screen
bounding box
(210,175)
window
(410,290)
(760,570)
(100,103)
Finally: Vector Graphics
Store shapes economically in the formof formulas or equations of geometricshapes
A line segment can be completelydescribed by its two endpoints…
Let’s look at the line a little closer
Here’s the vector we saw earlierdefined by it’s two endpoints
0
1
2
3
1
2
x
(1.41, 1.74)
(3.12, 0.95)
But…
To display a vector graphic youneed to convert the vector to abitmapped graphic…
This presents problems!
Convert Vector to Bitmapped
Visually...
“completely cover the vector with pixels”
0
1
2
3
1
2
x
Convert Vector to Bitmapped
Visually...
“completely cover the vector with pixels”
0
1
2
3
1
2
x
Convert Vector to Bitmapped
Results in an artifact…
a jagged line called an alias that looks
like a series of steps
0
1
2
3
1
2
x
How to mitigate this alias?
Anti-aliasing techniques are used but…
How does this work?
0
1
2
3
1
2
x
Anti-aliasing
0
1
2
3
1
2
x
our pixellated line tobe displayed is in black
Anti-aliasing
0
1
2
3
1
2
x
the original vector graphic storedin the internal model is in red
our pixellated line to bedisplayed is in black
Anti-aliasing
0
1
2
3
1
2
x
Anti-aliasing
0
1
2
3
1
2
x
anti2.jpg
Vector Graphics:drawing smooth curves?
Question: How would you draw a curveusing a computer with a mouse?
You can’t draw smooth lines very easily
A line tool with handles (based on theBezier curve) can be manipulated bythose handles
Lines and curves?
Bezier curves can be smoothly joinedtogether
An anchor point is the point whereone joins the other
When a curve closes on itself it isconsidered a closed curve
When it doesn’t it’s an open curve
Lines and curves?
Closed (and open for that matter) linescan be filled
solid color, pattern or gradient (linear orradial)
Lines can have different ends
mitre, rounded, square, bevel
The language ofManipulating objects…
Translation: is a simple up/down side-to-side movement
Scaling: make bigger or smaller
Rotation: about a point
Reflection: about a line
3D vector graphics?
MUCH more complex than 2-D
3-D shapes (objects) are defined bytheir surfaces
Made even more complicated by thefact that a 3-D object built inside thecomputer must be displayed as a 2-Dgraphic on a computer screen...
This results in the need to specify theviewpoint