diff --git a/rosys/geometry/point3d.py b/rosys/geometry/point3d.py index 4c15796f..5e1623ed 100644 --- a/rosys/geometry/point3d.py +++ b/rosys/geometry/point3d.py @@ -2,6 +2,7 @@ import math from dataclasses import dataclass +from typing import Sequence from .point import Point @@ -12,6 +13,11 @@ class Point3d: y: float z: float + @staticmethod + def from_tuple(t: Sequence[float]) -> Point3d: + """Create a Point3d from the three first elements of a sequence.""" + return Point3d(x=t[0], y=t[1], z=t[2]) + @property def tuple(self) -> tuple[float, float, float]: return (self.x, self.y, self.z)