# Direct orthonormed system

Hello,

By default the origin is in the top left corner, the x axis is pointing on the right and the y axis down.
Is it possible to get a “common” coordinate system (like the one usually used in math: origin bottom right corner, x axis pointing right and y axis pointing up)

I know the scale, rotate and translate function but my main problem is that I can’t scale the y axis by -1…

Thanks.

You can create a function that return the pixel coordinate based on your orthonormal system.

Let’s say you want your system to be

• 0 in the bottom left
• xMax in the bottom right
• yMax in the top left

Then a point (x, y) in your system would become ( (width / xMax) * x, - (heigth / yMax) * y) in the screen coordinate.

Why can’t you scale the y axis? It doesn’t work? Or your program should not do that?

``````translate(0, 100);
scale(1, -1);
rect(0, 0, 50, 50);
``````

Ho! I never thought to it, this is a great idea, thank you jb4x

hamoid, I tried to scale the y axis by -1 and translate but when I tried to draw sth, it was like if it didn’t work…
I will try again and informed you.

Here’s a more complete example to show @hamoid’s idea:

``````void setup() {
size(400, 400);
}

void draw() {
background(204);
translate(0, height);
scale(1, -1);
ellipse(0, 0, 50, 50);
ellipse(200, 200, 100, 100);
ellipse(200, 300, 10, 10);
}
``````