Home | Lehre | Videos | Texte | Vorträge | Software | Person | Impressum, Datenschutzerklärung | Blog
Vector Graphics
Idea
Do not store a bitmap of pixels but store the commands required to draw
an image: Don't send the cake, send the recipe instead.
-
This takes up less disk space than a bitmap for most drawings and similar
imagery.
-
The scale can be changed continuously; zooming in doesn't lead to jaggies
or blurriness.
-
This is not suited for photographic imagery. Photograps can be embedded,
though.
Types
The classical kind of vector graphics is an EPS (Encapsulated PostScript)
file: It contains a program creating the drawing, expressed in Adobe's
printer-oriented programming language
PostScript.
Such files may be stored using a space-saving binary encoding or they may
be stored as plain text. In the latter case, they can be edited with a
standard text editor, see the example given. PostScript is a full-fledged
programming language with a "postfix" notation [German term: UPN, umgekehrte
polnische Notation] that is uncommon today, but very efficient to read
(for the computer, not for the programmer). PostScript can be interpreted
(= rendered to a bitmap) by all high-end computer printers. On top of that,
it can be interpreted by software such as Adobe Photoshop or Ghostscript/GSview.
The AI file format of Adobe Illustrator is related to EPS.
Adobe PDF (Portable Document Format) is a sort of light-weight
EPS. Initially, it offered no programmability. In the meantime, however,
it has been equipped with functions for the Web (such as Links ot URLs),
functions for forms, and even a 3D rendering engine.
Microsoft XPS
(XML Paper Specification), formerly named Metro, is aimed at offering an
alternative to Adobe PDF. It is supported by the WPF (Windows Presentation
Framework, formerly named Avalon) of .NET 3.0, which is part of Windows
Vista. One possibly decisive difference to PDF is that XPS comes with a
free official toolkit for application developers.
Microsofts also offers vector formats that directly record Windows drawing
commands: WMF (Windows metafile), EMF (Enhanced Metafile),
and EMF+, with the different types reflecting the evolution of Windows'
graphics capabilites. You may record
commands into a metafile using standard graphics commands, and you can
look
at the recorded commands and draw
them as well. However, the Metafile.Save member function will only save
a PNG bitmap disguised as a metafile.
Adobe (ex Macromedia) Flash started out as a proprietary system
to create and render interactive and animated vector graphics. Through
a number of generations, it has gained a full-fleged programming language
as well.
SVG is an open
XML-based language for interactive and animated vector graphics, once embraced
and now abandoned by Adobe. Particularly remarkable ist the free editor:
Inkscape.
Primitives
Not every vector graphics file format can store any type of drawing command.
Color gradients (in particular, freely shaped ones) and transparency effects
have to be simulated or to be discarded for saving in PostScript 1 or WMF,
for instance.
The universal primitives that are available in every standard are:
-
Lines,
-
Bézier curves,
-
Filled polygons,
-
Filled closed Bézier curves,
-
Typeface characters,
-
(Embedded) bitmaps,
-
(Embedded) vector graphics of the same type
Cubic Curves
-
Curves as a versatile geometric primitive
-
Fixed shapes / parametrized shapes / free-form shapes
-
Cubic curves
-
Intuitive control of cubic curves? Not easily: demo with OpenOffice spreadsheet.
-
Hermite curves
-
A special way of representing cubic curves
-
Defined by start point, end point, initial and final velocity vector
-
p(t) = p0(2t3-3t2+1) + v0(t3-2t2+t)
+ v1(t3-t2) + p1(-2t3+3t2)
for t in [0,1]
-
Demo with OpenOffice spreadsheet
-
Bézier curves
-
Another special way of representing cubic curves
-
Defined by start point, end point, and two intermediate points that act
like magnets
-
p(t) = p0(1-t)3 + p13(1-t)2t
+ p23(1-t)t2 + p3t3
for t in [0,1]
-
Curve starts tangent to p1-p0 and ends
tangent to p3-p2
-
Demo with OpenOffice spreadsheet, Inkscape, and Cinema 4D
-
.NET: DrawBezier
-
Curves formed by joining several cubic segments
-
Geometric (dis-)continuity
-
.NET: DrawBeziers
-
Catmull-Rom splines
-
Given: a sequence of points to be converted
-
Objective: Compute a sequence of Hermite curves interpolating those points
-
Solution: It remains to define the velocity vectors of the Hermite representation.
For the start point and the end point choose the difference vector between
this point and its neighbor. For each other (i.e., interior) point choose
half the difference vector between the preceding point and the next point.
-
.NET: DrawCurve
-
B-Spline ("basic spline") curves
-
Approximating, not interpolating
-
B-spline curves and surfaces, demo with Cinema 4D and Maya
-
NURBS curves and surfaces with weight editing, demo with Blender
-
Spline curves for animation, demo with Cinema 4D