Skip to content

Instantly share code, notes, and snippets.

@julienetie
Last active February 28, 2021 17:54
Show Gist options
  • Save julienetie/38ab83d0429cd634d02d3feafc68b9e3 to your computer and use it in GitHub Desktop.
Save julienetie/38ab83d0429cd634d02d3feafc68b9e3 to your computer and use it in GitHub Desktop.
Trigonometry Helpers
const {PI, asin, acos, atan} = Math;
/**
Arcsine is an inverse of the sine function.
In other words, it helps to find the angle of a triangle which has a
know value of sine. As sine's codomain for real numbers is [−1, 1],
we can only calculate arcsine for numbers in that interval.
*/
// Inverse sin, cos and tan fns in degrees.
const asinDeg = r => 180 * asin(r) / PI;
const acosDeg = r => 180 * acos(r) / PI;
const atanDeg = r => 180 * atan(r) / PI;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment