We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
FloatCoordinate
Coordinate
1 parent 2863153 commit fd602e3Copy full SHA for fd602e3
1 file changed
funlib/geometry/float_coordinate.py
@@ -3,6 +3,8 @@
3
4
import numpy as np
5
6
+from .coordinate import Coordinate
7
+
8
9
class FloatCoordinate(tuple):
10
"""A ``tuple`` of numbers or None.
@@ -47,6 +49,10 @@ def dims(self) -> int:
47
49
48
50
def squeeze(self, dim: int = 0) -> "FloatCoordinate":
51
return FloatCoordinate(c for i, c in enumerate(self) if i != dim)
52
53
+ def round(self) -> Coordinate:
54
+ """Round to nearest integer and convert to Coordinate."""
55
+ return Coordinate(int(round(a)) if a is not None else None for a in self)
56
57
def is_multiple_of(self, coordinate: "FloatCoordinate") -> bool:
58
"""Test if this coordinate is a multiple of the given coordinate."""
0 commit comments