diff --git a/simulations/lib/location.py b/simulations/lib/location.py index 8b0bf45..c088f87 100644 --- a/simulations/lib/location.py +++ b/simulations/lib/location.py @@ -28,6 +28,7 @@ class Location: def __setitem__(self, key, val): self.x[key] = val + # math def __add__(self, other): if isinstance(other, Location): other = other.x @@ -40,12 +41,20 @@ class Location: return self.__class__(self.x - other) + def __mul__(self, other): + return self.__class__(self.x * other) + def __eq__(self, other): if isinstance(other, Location): other = other.x return np.all(self.x == other) + # math alias functions + __radd__ = __add__ + __rsub__ = __sub__ + __rmul__ = __mul__ + class Receiver(Location): """ A location able to trace a signal over time.