Map point onto 135-degree line then onto x- and y-axis intercepts

Given any point on the screen (mouseX, mouseY) I need to draw a triangle bordered by a 135-degree line through that point (slope == -1) and by the left and bottom axes. In other words, anchored on the bottom-left corner of the screen (0,height-1) and on the x- and y-axis points where the 135-degree line would intersect them.

My friend Matt and I had numerous issues with our Geometry teacher a few decades ago. As did he with us. :wink:

Thanks for any help!

This might be just me who doesn‘t quite understand it, but could you include an Image of how it should Look like? Better 2 images with different mouseX and y points, so that we can See what you mean better ^^

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

void draw(){
  background(0);
  float v = mouseX + height - mouseY;
  triangle(0,height,0,height-v,v,height);
}
1 Like

That’s beautiful TfGuy44! Couldn’t the simplicity of it without your help.
Thanks a million!