diff options
Diffstat (limited to 'src/argaze/GazeFeatures.py')
-rw-r--r-- | src/argaze/GazeFeatures.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py index cef9aaa..4d2ef80 100644 --- a/src/argaze/GazeFeatures.py +++ b/src/argaze/GazeFeatures.py @@ -54,13 +54,17 @@ class GazePosition(): return self.precision is not None - def overlap(self, gaze_position) -> float: - """Does this gaze position overlap another gaze position considering their precisions?""" + def overlap(self, gaze_position, both=False) -> float: + """Does this gaze position overlap another gaze position considering its precision? + Set both to True to test if the other gaze position overlaps this one too.""" - dist = (self.value[0] - gaze_position.value[0])**2 + (self.value[1] - gaze_position.value[1])**2 - dist = numpy.sqrt(dist) + dist = (self.value[0] - gaze_position.value[0])**2 + (self.value[1] - gaze_position.value[1])**2 + dist = numpy.sqrt(dist) - return dist < min(self.precision, gaze_position.precision) + if both: + return dist < min(self.precision, gaze_position.precision) + else: + return dist < self.precision def draw(self, frame, color=(0, 255, 255)): """Draw gaze position point and precision circle.""" |