angle_between

marxs.math.utils.angle_between(angle, border1, border2)[source] [edit on github]

Test if an angle is between two others

Since angles are cyclic, a simple numerical comparison is not sufficient, e.g. 355 deg is in the interval [350 deg, 10 deg] even though numerically 355 is not less then 10.

Parameters:
anglefloat or np.array

Angle array (in rad)

border1float

Lower border of interval (inclusive) in radian

border2float

Higher border of interval (inclusive) in radian

Returns:
comparisonbool of same shape as angle

Result of the comparison

Examples

>>> from marxs.math.utils import angle_between
>>> angle_between(-0.1, -0.2, 6)
True