The simplest way is to use the trigonometry method Math.atan2
to compute the angle in radians, convert it to degrees with Math.toDegrees
, perform your adjustment, convert it back to radians with Math.toRadians
, then use the trigonometry method Math.tan
to convert a radian value back to a slope. You'll want to watch out for a potentially infinite slope coming back from the tan
method.
Here's the Javadocs on the Math
class.