Coordinate systems: 2D, 3D, right-handed, Z-up
Origins, axes and coordinates; why BIM uses a right-handed Z-up system; how to convert from Y-up formats such as glTF; and why the screen’s Y axis points down.
In plan: X and Y
In 3D: add Z for height
Right-handed and left-handed
Handedness also fixes which way is a positive rotation: in a right-handed system, a positive angle about Z turns counter-clockwise when you look down from above. That is the convention used throughout this course. It decides the direction of the cross product (coming in the Vectors module), which is how software finds a face’s outward normal. Mixing the two silently mirrors a model: left becomes right, and every door swings the wrong way.
| Software or format | Up axis | Handedness |
|---|---|---|
Converting Y-up to Z-up
using P3 = (double X, double Y, double Z); static P3 YUpToZUp(P3 p) => (p.X, -p.Z, p.Y);static P3 ZUpToYUp(P3 p) => (p.X, p.Z, -p.Y); P3 columnTop = (4, 3, -2); // from a glTF file: Y is upP3 inModel = YUpToZUp(columnTop);Console.WriteLine($"Z-up: {inModel}");Console.WriteLine($"Back: {ZUpToYUp(inModel)}");Z-up: (4, 2, 3) Back: (4, 3, -2)
Screens point Y down
// Plan (metres, Y up) to a canvas (pixels, Y down) that is 'height' pixels tall.static (double X, double Y) ToScreen(double x, double y, double scale, double height) => (x * scale, height - y * scale); Console.WriteLine(ToScreen(0, 0, 50, 400)); // origin: bottom-left cornerConsole.WriteLine(ToScreen(6, 4, 50, 400));(0, 400) (300, 200)
Several origins in one project
Show a hint
(x, -z, y), then keep the point whose Z is largest.
Show the solution
using P3 = (double X, double Y, double Z); static P3 YUpToZUp(P3 p) => (p.X, -p.Z, p.Y); P3[] fromFile = { (1, 3.5, -2), (4, 7.2, -1), (2, 6, -5) }; P3 highest = YUpToZUp(fromFile[0]);foreach (P3 p in fromFile){ P3 q = YUpToZUp(p); if (q.Z > highest.Z) highest = q;}Console.WriteLine($"Highest: {highest}");Highest: (4, 1, 7.2)
Remember
A coordinate system is an origin, axes and a unit; a coordinate is the distance along each axis. BIM tools and IFC use a right-handed, Z-up system: X east, Y north, Z up, positive rotation counter-clockwise from above. Right-handed Y-up to Z-up is (x, y, z) → (x, −z, y); dropping the minus sign mirrors the model.Screens put Y down: flip and scale to draw a plan. Projects have several origins (internal, project base, survey, local), connected by transforms.