liveBook · Manning

Coordinate system

As explained in Systems Programming with Zig

A coordinate system is a framework that assigns numerical coordinates to positions in a geometric space.

A vector is just a group of numbers until a coordinate system tells you what those numbers mean. In graphics, screen space describes pixels relative to the window’s top-left corner; it is useful for drawing interface elements and processing mouse input. section 7.4.2

A vertex shader translates geometry into normalized device coordinates, where the screen center is (0, 0, 0) and x and y values of −1 and +1 mark the screen edges. More precisely, shader output is in clip space as (x, y, z, w); dividing x, y, and z by w produces normalized device coordinates. Setting w to 1.0 avoids changing those coordinates through that division. Geometry outside clip space is not visible. section 7.4.2

A triangle as a graphics starting point

Drawing a triangle is a compact way to get started with graphics programming. Its vertices only become meaningful when interpreted in a coordinate system. section 7.4.2

Figure 7.5 Screen space vs. normalized device coordinates
CH07 F05 hinsonhasty

Compare screen space with normalized device coordinates to see how the coordinate frame changes. section 7.4.2

How Systems Programming with Zig covers it

How deep it goes
Defines screen space and normalized device coordinates, then explains clip-space division by w and clipping while leaving depth unused.
Examples
Uses window pixels, a centered coordinate cube, and a triangle exercise to illustrate coordinate frames.
What it assumes
Builds from grouped-number vectors and offers geometry, CSS, or map familiarity as optional intuition.
What you can do after
Understand how coordinate frames give graphics vectors meaning and distinguish screen pixels from shader coordinates.
How it connects
Connects vectors with screen space, normalized device coordinates, clip space, vertex shaders, and rasterization.

Also explained in

Compare how 5 books explain coordinate system →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Systems Programming with Zig. The section links point to the parts of the book it draws on.