Skip to content
Snippets Groups Projects
Commit 25471fac authored by Davis, Duane T's avatar Davis, Duane T
Browse files

ap_lib: Added a contains method (sector containment of a third angle)

parent 3a5ee79a
No related branches found
No related tags found
No related merge requests found
...@@ -100,6 +100,19 @@ def normalize_pi(angle): ...@@ -100,6 +100,19 @@ def normalize_pi(angle):
return angle return angle
def sector_contains(min_angle, max_angle, test_angle):
''' Tests whether or not a test angle lies in a particular heading
sector (i.e., does a heading sweap from the sector min to the sector
max pass through the test angle). A test angle lying on the sector
edge is NOT contained. All angles are normalized to a range of [0, 2pi).
@param min_angle: angle (radians) defining the start of the sector
@param max_angle: angle (radians) defining the end of the sector
@param test_angle: angle (radians) being tested
@returns True if the test angle lies between the min and max angle
'''
return normalize(test_angle - min_angle) < normalize(max_angle - min_angle)
# Vector functions # Vector functions
def scalar_multiply(v1, s): def scalar_multiply(v1, s):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment