☰ Contents · Computing

Types of 2D and 3D graphics

Lessons 2 · 1 lessons · N. I. Taylaqov (general editor), A. B. Akhmedov, M. D. Pardayeva, A. A. Abdug‘aniyev, U. M. Mirsanov. Informatics and Information Technologies, Grade 11, 1st edition. “Extremum-press”, Tashkent, 2018
2

Types of two- and three-dimensional computer graphics

Textbook: pp. 7–10
GoalDistinguishes 2D from 3D graphics, compares raster, vector and fractal graphics, and calculates with the size and density of a raster image.
New words
raster graphics: a picture made of rows and columns of pixels · rastrli grafikavector graphics: a picture stored as a set of simple shapes and their parameters · vektorli grafikafractal: a shape made of parts that look like the whole; it can be created by a simple formula · fraktaldpi (dots per inch): the number of pixels or dots per inch of length, i.e. the density of a raster · dpi
Explanation

By the way it is created, computer graphics is two-dimensional (2D) or three-dimensional (3D). In 3D graphics the surface of an object is covered with a net of small triangles, then painted, lit and given shadows; this step is called rendering and needs many calculations. Three-dimensional graphics is used in animation, computer games and virtual reality; in a virtual-reality headset a separate picture is made for each eye. 2D graphics has three kinds. In raster graphics the picture consists of pixels in rows and columns: photographs, scanners and phone cameras work this way; its size is the number of columns and rows and its density is measured in dpi. A raster can hold a high-quality photo, but it needs much memory and becomes blurry when enlarged. In vector graphics the picture is stored as a list of simple shapes (segment, circle, curve) and their parameters; it takes little space and keeps its quality when the scale changes, but it cannot store a photograph; fonts are also drawn from vectors. In fractal graphics shapes made of self-similar parts (a snowflake, the branching of a tree) are created from simple formulas; the term “fractal” was introduced to science in 1975.

Worked examples
A raster of 2400×1800 pixels at 300 dpi measures 2400:300 = 8 inches by 1800:300 = 6 inches on paper (1 inch = 2.54 cm, so about 20×15 cm). At 150 dpi the same file spreads to 16×12 inches but looks softer.
An orange circle: the vector record <circle cx="50" cy="50" r="40" fill="orange"/> is only 46 characters (bytes). The same 100×100 pixel circle in a 24-bit raster takes 100·100·3 = 30 000 bytes; enlarged 10 times the vector record stays the same, while the raster needs 100 times more pixels. In the Koch curve each step replaces every segment by 4 segments: after 3 steps there are 4·4·4 = 64 segments.
Class activity

“Which graphics?”: the teacher reads a list of pictures (photo, logo, snowflake, tree branching, X-ray image). Pairs show on a card whether each one is raster, vector or fractal and give a one-sentence reason.

Practice
1
Name the three kinds of two-dimensional graphics.
2
A 1800×1200 pixel photo is printed at 300 dpi. How many inches wide will it be?
3
Choose the most suitable kind of graphics: a) a family photo; b) a company logo printed on a banner; c) mountains in a game landscape generated by a formula.
4
Why does a raster picture become blurry when enlarged while a vector one does not?