Try fixing the boundary condition where alpha+beta
and beta-alpha
lies on either side of the positive x-axis. Assuming all your angles, beta
and theta
lie in the range (0, 2*Pi), this might work :
def checkMargingForTheta(alpha, beta, theta):
low = beta - alpha
high = beta + alpha
if(high > 2*pi):
high = high - 2*pi
if(low < 0):
low = 2*pi + low
if(low > high):
return (theta > low)
else:
return (low < theta and high > theta)