I would like to calculate the distance between two degree values. I know that I could use this if the points just where on one axis:
var dist = Math.abs( x1 - x2 );
...but the problem with degrees is, that they can either be negative or positive, also they could be somewhere above 360. My goal is to calculate the distance, no matter if the rotation is negative or higher then 360°
EDIT
To make it clearer what I want: For example, I could could have the values -90deg
and 270deg
. This should result in a result of 0
for the distance. If the first element's rotation would change to either -100deg
of -80deg
, the distance should change to 10
.