Goal is to represent a 3D scene on a 2D canvas, an abstract rectangular array of pixels.

3D graphics coordinates system is usually the same as euclidean space. 0,0 in the center. +X to the right, +Y to the top.

For a width C_w we can draw from -(C_w/2) to +(C_w/2) - 1.

To actually draw the canvas to the screen, we need to swap to screen coordinates.

For a canvas coordinate C_x, C_y, the screen coordinates are

S_x = (C_w/2) + C_x S_y = (C_h/2) - C_y

Because we shift to the center, then reverse Y.

Assume a function PutPixel(x,y,color) that performs this conversion automatically.

Alternatively you could call S_x,S_y = CanvasToScreen(C_x, C_y)

We perform saturated arithmetic on RGB colors.

So k(R,G,B) = (clamp(0, 255, kR), clamp(0, 255, kG), clamp(0, 255, kB))

The scene is the set of objects you’re trying to render.

The canvas uses pixel units, but the scene uses real-world units (like 2.3meters). For the scene, +Y is Up, +Z is Forward, +X is right. So XZ is the “floor” while XY and YZ are vertical “walls” in a square room.

To recap: We render a 3D scene (in real units, scene coordinates) to a 2D canvas (in pixels, canvas coordinates) and then draw that canvas to the 2D screen (in pixels, screen coordinates)