Dear Bruno,
the line
int yEdge = map(0, -115, x1, 160, y1); could be written as:
int yEdge = 160 + 115 *tan(1.57078 -x1);
It derives from the formula:
a = b * tan(arc); with given arc, b. ...