[Math] How to normalize the slope of a line

geometrygraphing-functionstrigonometry

Assuming I have different lines with different slopes, I would like to compare the slope of each line as relative to one another.
The program I am currently writing needs to compare the slopes of the lines on a 0 to 1 basis (1 being very steep, or equivalent of a slope of infinity and 0 being equivalent to a slope of 0)
However, right now I have the values of the slope in absolute form, going from 0 to infinity. May I know how to accurately map these slopes to a scale of 0 to 1?

Best Answer

The slope measure form 0 to 1 is basically an angle (lets call it $\alpha$), the other one is the slope, lets call it $m$. The relation is

$$ m = \tan\left( \alpha \cdot \frac{\pi}{2} \right)$$ if you are calculating with radians or

$$ m = \tan\left( \alpha \cdot 90° \right)$$ if you are calculating in degrees.

Related Question