def offset(self, pin: Point): if len(pin) == 1 and len(self) > 1: pin = Point.full(pin, self.count) elif len(self) == 1 and len(pin) > 1: return self.full(len(pin)).offset(pin) if not len(pin) == len(self): raise ValueError(f"incompatible lengths for offset ({len(self)}) - ({len(pin)})") latb = self.lat + pin.x / LOCFAC return GPS( latb, self.long + pin.y / (LOCFAC * safecos(latb)) )
def test_full(): points = Point.full(Point(1,2,3), 100) assert len(points) == 100 assert isinstance(points, Point) assert points[20] == Point(1, 2, 3)