I've got a line (x1,y1) and (x2,y2). I'd like to use tan inverse to find the angle of that line, how would I do so in java?
I'd like to see what angle the line makes in relation to x1,y1
Inverse tan is the inverse function of the trigonometric function 'tangent'. It is used to calculate the angle by applying the tangent ratio of the angle, which is the opposite side divided by the adjacent side of the right triangle. Based on this function, the value of tan 1 or arctan 1 or tan 10, etc.
Figure out the slope of the tangent line. This is m=f′(a)=limx→af(x)−f(a)x−a=limh→0f(a+h)−f(a)h.
The method for finding a function's inverse can be summarized in two steps: Step 1: rearrange the expression y=f(x) to make x the subject. By the end of this you sould have an expression looking like x=f(y). Step 2: swap x and y in the expression obtained at the end of Step 1, the expression obtained is y=f−1(x).
You need
Math.toDegrees(Math.atan((y2-y1)/(x2-x1)))
Do notice exception when x1=x2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With