Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find the inverse tangent of a line?

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

like image 645
Skizit Avatar asked Aug 10 '10 14:08

Skizit


People also ask

How do you use inverse tangent?

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.

What is the formula for slope of a tangent line?

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.

What is the inverse of a line?

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).


1 Answers

You need

Math.toDegrees(Math.atan((y2-y1)/(x2-x1)))

Do notice exception when x1=x2.

like image 111
Gedrox Avatar answered Oct 01 '22 19:10

Gedrox