This question follows on from find the length of any arc on a circle
From that question:
I have a magnetic encoder that returns the position of the shaft from 0 to 4095.
The servo has two logical end points, call them MAX and MIN which are set in software and can be changed at any time, and the shaft must rotate (i.e. travel) on one arc between the MAX and MIN positions. For example in the picture the blue arc is valid but the red is not for all travel between and including MIN and MAX.
I am trying to work out a simple algorithm to validate that where travel is allowed on the BLUE side of my circle, that A and B are on the BLUE arc and neither are on the RED arc, and the opposite where if the allowed arc of travel is RED, then A and B are both on the RED arc?
Note: A and B are set by the calling program and are always changing.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…