How could I make p5 work in a cartesian coordinate system?

I kind of get what I want but I still have problems using mouseX and mouseY, they don’t work propertly when I try to change it.

mouseX is how many pixels from the left edge the mouse is.

mouseY is how many pixels from the top edge the mouse is.

This is slightly different from a mathematical coordinate system, which usually has the positive Y direction going up from the bottom edge.

Yeah, I know, but I mean if I try to change it, how could I do for making those variables to work if they should in the system that I’m trying to use?

Just use (height-mouseY) instead of mouseY!

1 Like

Thank you for your answer!

A couple of things (be sure to comment one or the other) I have done in the past to modify what I plot to screen:

void setup() 
  {
  size(500, 500);
   }

void draw() 
  {
  background(0);
  
  //Method 1 This is one.
  //scale(1, -1);
  //translate(0, -height);
  
  for (int x=0; x<width; x++)
    {
    int y = x;
    y = height -y;  //Method 2 wherever there is a y. This is the other.
    strokeWeight(3);
    stroke(255, 255, 0);
    point(x, y);
    }  
}

:)