| 33 | |
| 34 | @dataclass |
| 35 | class Point: |
| 36 | x: float |
| 37 | y: float |
| 38 | |
| 39 | @staticmethod |
| 40 | def toJson(points: list["Point"]) -> list[dict]: |
| 41 | x_values = [p.x for p in points] |
| 42 | y_values = [p.y for p in points] |
| 43 | # round |
| 44 | x_values = [round(x, 4) for x in x_values] |
| 45 | y_values = [round(y, 4) for y in y_values] |
| 46 | if MIRROR_X: |
| 47 | x_values = [-x for x in x_values] |
| 48 | |
| 49 | return {"x": x_values, "y": y_values, "diameter": LED_DIAMETER} |
| 50 | |
| 51 | def copy(self) -> "Point": |
| 52 | return Point(self.x, self.y) |
| 53 | |
| 54 | def __repr__(self) -> str: |
| 55 | x_rounded = round(self.x, 2) |
| 56 | y_rounded = round(self.y, 2) |
| 57 | return f"({x_rounded}, {y_rounded})" |
| 58 | |
| 59 | |
| 60 | def next_point(pos: Point, angle: HexagonAngle, space: float) -> Point: |
no outgoing calls
no test coverage detected