diff --git a/cereja/geolinear/point.py b/cereja/geolinear/point.py index d4a15bd..c8bbcd4 100644 --- a/cereja/geolinear/point.py +++ b/cereja/geolinear/point.py @@ -230,6 +230,19 @@ def rotate(self, angle: float, center=(0, 0, 0), axis: str = 'z') -> 'Point': else: raise ValueError(f"Invalid axis: {axis}. Axis should be 'x', 'y', or 'z'.") + def manhattan_distance_to(self, other: 'Point') -> float: + """ + Computes the Manhattan distance between this point and another point. + + Args: + other (Point): The other point to which the Manhattan distance is calculated. + + Returns: + float: The Manhattan distance between the two points. + """ + other = Point(other) + return abs(sum(self - other)) + def __getitem__(self, item: Union[int, str]) -> Union[int, float]: """Allows indexing into the point to retrieve its coordinates.""" if isinstance(item, str):