2
$\begingroup$

hey so i'm programming something that finds an angle of a line between 0 and 180 degrees based on two points....

the equation to find the answer is Angle = sin-1((1/Hypotenuse)*B)where B is the vertical side of the triangle formed and the hypotenuse is the distance between point 1 and 2.

However the inverse sin function in my program only takes and outputs radians so instead the equation to get degrees becomes

(Angle = sin-1(((1/Hypotenuse)*B *3.14) /180) *180) /3.14

This does not however seem to be right for some reason, as when putting in the parameters of Hypotenuse=150, B=149.6 i get the answer of 85.8 (right) for the original equation and then .9973 degrees for the new equation??

Please help me fix this!

  • 2
    The inputs of the arcsin function are not in degrees or radians. That's the main problem.2011-06-27

2 Answers 2

3

If $B$ is the length of the opposite side, and $H$ is the length of the hypothenuse, then $B/H$ is the sine of the angle. This is not measured in either degrees or radians; it's the value of the sine.

If you take $\arcsin(B/H)$, this will be given in radians. To convert to degrees, you multiply be $180/\pi$. So what you want is: $\mathrm{angle} = \arcsin\Biggl(\left(\frac{1}{\text{hypothenuse}}\right)*B\Biggr)*180\Bigm/\pi.$

$3.14$ is a very rough approximation to $\pi$.

0

You would calculate the answer in radians, and then convert to degrees. Inside of the inverse sin should just be (1/hypotenuse*B) since its a ratio of side lengths.

You're overthinking it, I'm guessing.