The slope of a straight line is expressed by the following equation
If we were to draw in p5.js coordinate space, we would first set up two points like this. There is a right triangle behind them. This may be a long way off, but let’s do some calculations and drawing in p5.js to sort out the coordinates, slope, angle, etc. You might even get a nice diagram out of it.
At first, we can express the relationship as follows