Theory
The building blocks of every picture
However complex a computer drawing looks, it is built from a small set of basic shapes called primitives. A game character, a diagram, a font glyph, all are ultimately made of points, lines, and curves combined.
This lesson introduces the core graphics objects: the point, the line, the circle and ellipse, and the polygon. Knowing how each is defined mathematically matters, because the next unit is about drawing these onto the pixel grid, and you cannot draw a shape you cannot describe. Learn the primitives, and the drawing algorithms will make sense.
At a glance
| Object | Defined by |
|---|---|
| Point | A single position: coordinates (x, y) |
| Line | A straight segment between two endpoints (x1, y1) and (x2, y2) |
| Circle | All points at radius r from a centre (h, k) |
| Ellipse | Like a circle but with two radii (a horizontal, b vertical) |
| Polygon | A closed shape of straight line segments joining vertices |
Theory
Point, line, and the round shapes
The point is the most basic object: a single position given by coordinates (x, y), drawn as one pixel. Everything else is built from points.
A line is a straight segment joining two endpoints, (x1, y1) and (x2, y2). It is the workhorse primitive, most shapes are made of lines.
A circle is the set of all points at a fixed distance, the radius r, from a centre (h, k). An ellipse generalises the circle: it has two radii, one horizontal (a) and one vertical (b), so it looks like a stretched circle. When a equals b, an ellipse is just a circle. These round shapes are defined by their centre and radii rather than endpoints.
Theory
Polygons: closed shapes from lines
A polygon is a closed figure made of straight line segments (its edges) joining a set of corner points (vertices). A triangle is a 3-sided polygon, a rectangle a 4-sided one, and so on.
Polygons are essential because they build up complex shapes from simple lines, and in particular, 3D objects are usually modelled as meshes of polygons (often triangles). So the humble line, joined end to end into closed loops, becomes the basis for representing almost any shape. This is why drawing a line well (the next unit's focus) is so foundational: lines make polygons, and polygons make everything else.
Quiz
How is a circle defined as a graphics primitive?
- By two endpoints, like a line
- As all points at a fixed distance (the radius r) from a centre point (h, k)
- As a closed shape of straight line segments
- By two different radii, one horizontal and one vertical
Show the answer
As all points at a fixed distance (the radius r) from a centre point (h, k)
A circle is defined as the set of all points at a fixed distance, the radius r, from a centre point (h, k); every point on the circle is exactly r away from the centre. Option A describes a LINE (two endpoints), not a circle. Option C describes a POLYGON (a closed shape of straight line segments), which is not a smooth curve. Option D describes an ELLIPSE, which has TWO radii (horizontal a and vertical b); a circle is the special case where both radii are equal. So a circle needs a centre and one radius; that is its defining description.
Think first
Why does representing shapes as primitives matter for drawing them?
Why break every image into points, lines, circles, and polygons rather than treating it as a whole? Then tap.
Show the answer
Because a computer can only draw what it can DESCRIBE precisely, and reducing every image to a few well-defined primitives means you only need algorithms for those few, then you can build ANY picture by combining them. A raster display ultimately lights up individual pixels, so to draw a shape the computer must calculate exactly WHICH pixels belong to it, and that calculation depends entirely on the shape's mathematical definition. A line defined by two endpoints has a clear formula for which pixels lie along it (that is what DDA and Bresenham compute); a circle defined by a centre and radius has a clear rule for its pixels; a polygon is just a sequence of lines. Because these primitives are simple and precisely defined, we can write efficient, correct drawing algorithms for each ONCE. Then any complex image, no matter how elaborate, is assembled from these building blocks: a character is polygons and curves, a diagram is lines and circles, a 3D model is a mesh of triangles. This is a powerful decomposition: instead of needing a bespoke method for every possible picture (impossible), you need drawing routines for a handful of primitives, plus a way to combine and position them (which is where transformations come in). It mirrors how complex programs are built from simple functions, or complex structures from simple parts. So defining shapes as primitives is not just tidy notation; it is what makes drawing tractable, describe an image as primitives, and you can render it pixel by pixel. Simple, precise building blocks make any picture drawable.
Summary
Key takeaways
- All pictures are built from basic graphics primitives.
- A point is a single position (x, y), drawn as one pixel, the most basic element.
- A line is a straight segment between two endpoints (x1, y1) and (x2, y2).
- A circle is all points at radius r from a centre (h, k); an ellipse is like a circle but with two radii (horizontal a, vertical b).
- A polygon is a closed shape of straight line segments joining vertices (triangle, rectangle, and so on).
- Complex and 3D shapes are built from these primitives (3D often as polygon meshes of triangles).
- Memory hook: point, line, circle, ellipse, polygon are the building blocks the drawing algorithms render.