Coordinate Systems

Where Things Are

1

The Cartesian Plane

Every point in 2D space can be described with just two numbers: how far right (X) and how far up (Y).

(3, 2)
Coordinates

Named After René Descartes

In 1637, this French mathematician invented a way to connect algebra and geometry. His idea: use numbers to describe positions! The Cartesian plane is named after him.

2

Screen Coordinates Are Different!

In math class, (0,0) is in the center and Y goes up. But on your computer screen...

Math Coordinates

Origin at center, Y goes UP

Screen Coordinates

Origin at TOP-LEFT, Y goes DOWN

This Trips Up Every Beginner!

To move something UP on screen, you SUBTRACT from Y. To move DOWN, you ADD to Y. It's the opposite of what you'd expect from math class!

// Moving a character UP on screen
player.y = player.y - 10; // Subtract to go up!

// Moving DOWN on screen
player.y = player.y + 10; // Add to go down!
3

Why Is Y Flipped?

This quirk goes back to the very first computer monitors...

CRT (Cathode Ray Tube) Monitors

Old monitors drew images by shooting electrons at the screen. The beam started at the top-left and scanned left-to-right, top-to-bottom - just like reading a book! So pixel (0,0) was naturally the first pixel drawn.

Even though we use flat screens now, this convention stuck. Every web page, video game, and phone app still uses top-left as the origin!

4

Find the Coordinates!

Click anywhere on the canvas below to see its screen coordinates:

-
X (from left)
-
Y (from top)
-
Position %

Try This!

Click the corners! Top-left is (0,0) and bottom-right is (599, 349) - that's 600 pixels wide by 350 tall.

5

World vs Screen Coordinates

Games often have a large "world" that's bigger than your screen. The camera decides what part you see!

(200, 150)
Star World Pos
(200, 150)
Star Screen Pos
// World to Screen conversion
screenX = worldX - camera.x;
screenY = worldY - camera.y;

// Screen to World conversion
worldX = screenX + camera.x;
worldY = screenY + camera.y;
6

Adding the Third Dimension

2D has X and Y. For 3D, we add Z for depth! Drag to orbit, scroll to zoom.

(2, 3, 1)
3D Position

Which Way Is Z?

Different systems disagree! In some, Z points UP (common in CAD software). In others, Z points toward you (common in games). Always check the documentation!

7

Polar Coordinates

Sometimes it's easier to describe positions by angle and distance instead of X and Y.

100
r (distance)
45°
θ (angle)
(71, 71)
Cartesian
// Polar to Cartesian
x = r * Math.cos(angle);
y = r * Math.sin(angle);

// Cartesian to Polar
r = Math.sqrt(x*x + y*y);
angle = Math.atan2(y, x);

When to Use Polar?

Perfect for circular motion (orbits, radar sweeps), aiming at targets, and anything involving rotation!

8

UV Coordinates (Texture Mapping)

When wrapping images onto 3D objects, we use UV coordinates - always from 0 to 1, regardless of image size!

(0.25, 0.75)
UV (0-1)
(64, 192)
Pixel (256×256)

Why 0 to 1?

Makes UVs independent of resolution! (0.5, 0.5) is always the center, whether the texture is 64×64 or 4096×4096.

V Direction Varies!

In OpenGL, V=0 is at the bottom. In DirectX, V=0 is at the top. This causes many "flipped texture" bugs!

9

Test Your Skills!

Click on the exact coordinates shown. How fast can you find them?

Score: 0 / 10 Time: 0.0s
Click Start to begin!
Pro Tip

After 5 seconds, a hint circle will appear around the target!

You've Mastered Coordinates!

Now you know how computers describe where things are - from 2D screens to 3D worlds!

0
Interactions
0
Best Game Score
0
Time Exploring

Screen vs Math

Screen coordinates start at top-left with Y going DOWN - the opposite of math class.

World & Camera

Game worlds can be huge - the camera shows just a portion at screen coordinates.

3D Coordinates

Adding Z creates depth - but which way Z points depends on the software!

Polar & UV

Sometimes angles work better than X/Y. UV coordinates (0-1) map textures to 3D.

Ready to Create?

Put your new knowledge into practice!

Suggest a Correction