1from typing
import Union, Any
3from ids_peak_common._internal.utils
import is_equal, validate_parameter_types
9 Represents a point in 2D space with x and y coordinates.
11 @ingroup ids_peak_common_python_types_geometry
14 def __init__(self, x: Union[int, float], y: Union[int, float]):
17 Initializes a Point instance.
19 @param x: x coordinate
20 @param y: y coordinate
22 validate_parameter_types(x, y, accepted_types=(int, float))
23 self.
_x: Union[int, float] = x
24 self.
_y: Union[int, float] = y
26 def __eq__(self, other: Any) -> bool:
29 Determines if this point is equal to another point or coordinate pair.
31 @param other: Another Point object OR List of coordinates [x,y] OR Tuple of coordinates (x,y)
33 @return True if points are equal, False otherwise
35 if isinstance(other, Point):
36 return is_equal(self.
xx, other.x)
and is_equal(self.
yy, other.y)
37 if isinstance(other, (list, tuple)):
40 return is_equal(self.
xx, other[0])
and is_equal(self.
yy, other[1])
43 def __ne__(self, other: Any) -> bool:
46 Determines if this point is not equal to another point or coordinate pair.
48 @param other: Another Point instance, or a list/tuple with two numeric elements [x, y] or (x, y).
50 @return True if points are not equal, False otherwise
52 return not self.
__eq__(other)
57 Returns a string representation of the Point.
59 A string in the format "(x: <x_value>, y: <y_value>)".
61 return f
"(x={self.x}, y={self.y})"
66 Return an unambiguous string of the Point object.
68 return f
"{self.__class__.__name__}{str(self)}"
71 def x(self) -> Union[int, float]:
75 def y(self) -> Union[int, float]:
Represents a point in 2D space with x and y coordinates.
__init__(self, Union[int, float] x, Union[int, float] y)
Initializes a Point instance.
Union[int, float] x(self)
bool __ne__(self, Any other)
Determines if this point is not equal to another point or coordinate pair.
Union[int, float] y(self)
str __str__(self)
Returns a string representation of the Point.
str __repr__(self)
Return an unambiguous string of the Point object.
bool __eq__(self, Any other)
Determines if this point is equal to another point or coordinate pair.