-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdata_types.py
More file actions
29 lines (25 loc) · 770 Bytes
/
data_types.py
File metadata and controls
29 lines (25 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import math
class TrackState(object):
New = 0
Tracked = 1
Lost = 2
LongLost = 3
Removed = 4
class Angle(object):
delta = 1e-3
def __init__(self,_sentinel=None,angle=None,x=None,y=None) -> None:
if angle is not None:
self.angle = angle
else:
angle = math.atan2(y,x)
if angle<0:
angle += math.pi*2
self.angle = angle*180/math.pi
def __eq__(self,other):
if math.fabs(self.angle-other.angle)<self.delta:
return True
else:
if self.angle<other.angle:
return math.fabs(self.angle+360-other.angle)<self.delta
else:
return math.fabs(self.angle-360-other.angle)<self.delta