The angle between the x-axis and a line with slope m
is given by Math.atan(m)
. Here's how you can find it in JavaScript:
index.tsx100 chars4 lines
The angle will be in radians, so you might want to convert it to degrees using Math.degrees(angle)
if necessary.
gistlibby LogSnag