ArticleslgStudy

computer science

2D computer graphics

2D computer graphics is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand 2D computer graphics rather than just read about it. In short: 2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models (such as 2D geometric models, text, and digital images) and by techniques specific to them. It may refer to the branch of computer science that comprises such techniques or to the models themselves. 2D computer graphics are mainly used in applications that were originally developed upon traditional printing and…

2D computer graphics — main illustration
2D computer graphics — illustration

Key takeaways

  • 2D computer graphics belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect 2D computer graphics to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of 2D computer graphics from memory before moving on to harder problems.

Reference excerpt

2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models (such as 2D geometric models, text, and digital images) and by techniques specific to them. It may refer to the branch of computer science that comprises such techniques or to the models themselves.

2D computer graphics are mainly used in applications that were originally developed upon traditional printing and drawing technologies, such as typography, cartography, technical drawing, advertising, etc. In those applications, the two-dimensional image is not just a representation of a real-world object, but an independent artifact with added semantic value; two-dimensional models are therefore preferred, because they give more direct control of the image than 3D computer graphics (whose approach is more akin to photography than to typography). In many domains, such as desktop publishing, engineering, and business, a description of a document based on 2D computer graphics techniques can be much smaller than the corresponding digital image—often by a factor of 1/1000 or more. This representation is also more flexible since it can be rendered at different resolutions to suit different output devices. For these reasons, documents and illustrations are often stored or transmitted as 2D graphic files. 2D computer graphics started in the 1950s, based on vector graphics devices. These were largely supplanted by raster-based devices in the following decades. The PostScript language and the X Window System protocol were landmark developments in the field. 2D graphics models may combine geometric models (also called vector graphics), digital images (also called raster graphics), text to be typeset (defined by content, font style and size, color, position, and orientation), mathematical functions and equations, and more. These components can be modified and manipulated by two-dimensional geometric transformations such as translation, rotation, and scaling. In object-oriented graphics, the image is described indirectly by an object endowed with a self-rendering method—a procedure that assigns colors to the image pixels by an arbitrary algorithm. Complex models can be built by combining simpler objects, in the paradigms of object-oriented programming.

Background (geometry)

In Euclidean geometry, a translation (geometry) moves every point a constant distance in a specified direction. A translation can be described as a rigid motion: other rigid motions include rotations and reflections. A translation can also be interpreted as the addition of a constant vector to every point, or as shifting the origin of the coordinate system. A translation operator is an operator T𝜹 such that T𝜹f(𝐯)=f(𝐯+𝜹). If v is a fixed vector, then the translation Tv will work as Tv(p) = p + v. If T is a translation, then the image of a subset A under the function T is the translation of A by T. The translation of A by Tv is often written A + v. In a Euclidean space, any translation is an isometry. The set of all translations forms the translation group T, which is isomorphic to the space itself, and a normal subgroup of Euclidean group E(n ). The quotient group of E(n ) by T is isomorphic to the orthogonal group O(n ):

E(n ) / T ≅ O(n ).

Translation Since a translation is an affine transformation but not a linear transformation, homogeneous coordinates are normally used to represent the translation operator by a matrix and thus to make it linear. Thus we write the 3-dimensional vector w = (wx, wy, wz) using 4 homogeneous coordinates as w = (wx, wy, wz, 1). To translate an object by a vector v, each homogeneous vector p (written in homogeneous coordinates) would need to be multiplied by this translation matrix:

T𝐯=[100vx010vy001vz0001] As shown below, the multiplication will give the expected result:

T𝐯𝐩=[100vx010vy001vz0001][pxpypz1]=[px+vxpy+vypz+vz1]=𝐩+𝐯 The inverse of a translation matrix can be obtained by reversing the direction of the vector:

T𝐯−1=T−𝐯. Similarly, the product of translation matrices is given by adding the vectors:

T𝐮T𝐯=T𝐮+𝐯. Because addition of vectors is commutative, multiplication of translation matrices is therefore also commutative (unlike multiplication of arbitrary matrices).

Rotation

In linear algebra, a rotation matrix is a matrix that is used to perform a rotation in Euclidean space.

R=[cos⁡θ−sin⁡θsin⁡θcos⁡θ] rotates points in the xy-Cartesian plane counterclockwise through an angle θ about the origin of the Cartesian coordinate system. To perform the rotation using a rotation matrix R, the position of each point must be represented by a column vector v, containing the coordinates of the point. A rotated vector is obtained by using the matrix multiplication Rv. Since matrix multiplication has no effect on the zero vector (i.e., on the coordinates of the origin), rotation matrices can only be used to describe rotations about the origin of the coordinate system. Rotation matrices provide a simple algebraic description of such rotations, and are used extensively for computations in geometry, physics, and computer graphics. In 2-dimensional space, a rotation can be simply described by an angle θ of rotation, but it can be also represented by the 4 entries of a rotation matrix with 2 rows and 2 columns. In 3-dimensional space, every rotation can be interpreted as a rotation by a given angle about a single fixed axis of rotation (see Euler's rotation theorem), and hence it can be simply described by an angle and a vector with 3 entries. However, it can also be represented by the 9 entries of a rotation matrix with 3 rows and 3 columns. The notion of rotation is not commonly used in dimensions higher than 3; there is a notion of a rotational displacement, which can be represented by a matrix, but no associated single axis or angle. Rotation matrices are square matrices, with real entries. More specifically they can be characterized as orthogonal matrices with determinant 1:

RT=R−1,det⁡R=1. The set of all such matrices of size n forms a group, known as the special orthogonal group SO(n).

Techniques

… excerpt ends here. Continue reading the full article.

Illustrations

2D computer graphics: Raster graphic sprites (left) and masks
Raster graphic sprites (left) and masks
2D computer graphics: A translation moves every point of a figure or a space by the same amount in a given direction.
A translation moves every point of a figure or a space by the same amount in a given direction.
2D computer graphics: A 2D animated character composited with 3D backgrounds using layers
A 2D animated character composited with 3D backgrounds using layers

Worked examples

Example 1 — a first encounter with 2D computer graphics

Start with the simplest possible case. Write down what 2D computer graphics claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to 2D computer graphics before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about 2D computer graphics ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of 2D computer graphics

In research
2D computer graphics appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses 2D computer graphics in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
2D computer graphics is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer graphics, Euclidean plane geometry, so understanding it makes those chapters shorter.
In everyday life
Look for 2D computer graphics outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “2D computer graphics” →

How to study 2D computer graphics in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what 2D computer graphics means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain 2D computer graphics out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is 2D computer graphics in simple terms?

2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models (such as 2D geometric models, text, and digital images) and by techniques specific to them. It may refer to the branch of computer science that comprises such techniques or to the models thems…

Why does 2D computer graphics matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study 2D computer graphics?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on 2D computer graphics.

Tags

  • Computer graphics
  • Euclidean plane geometry

Keep exploring