IDS peak ICV v1.2.0
Loading...
Searching...
No Matches
coordinate_system.py
Go to the documentation of this file.
1from __future__ import annotations
2
4from ids_peak_icv.exceptions import NotSupportedException
5
6
8 """!
9 @brief
10 Represents the coordinate system of a calibration view that was projected into the 2D plane.
11 The coordinate system is represented by its origin and three vectors,
12 each corresponding to one of the three coordinate axes (X, Y and Z).
13 These vectors describe the directions of the respective axes projected from 3D into 2D space.
14 Their lengths are determined by twice the distance between neighboring markers on the calibration plate.
15
16 @ingroup ids_peak_icv_python_types_geometry
17 @since ids_peak_icv 1.1
18 """
19
20 def __init__(self, origin: Point, x_axis: Point, y_axis: Point, z_axis: Point) -> None:
21 """!
22 @brief
23 Creates a coordinate system.
24
25 @param origin: origin coordinate
26 @param x_axis: x_axis coordinate
27 @param y_axis: y_axis coordinate
28 @param z_axis: z_axis coordinate
29
30 @exception NotSupportedException: if the given arguments are not points.
31 @since ids_peak_icv 1.1
32 """
33
34 if not isinstance(origin, Point) and isinstance(x_axis, Point) and isinstance(y_axis, Point) and isinstance(
35 z_axis, Point):
36 raise NotSupportedException("Argument type has to be Point")
37
38 self._origin = origin
39 self._x_axis = x_axis
40 self._y_axis = y_axis
41 self._z_axis = z_axis
42
43 @property
44 def origin(self) -> Point:
45 """!
46 @brief
47 Origin of the coordinate system.
48
49 @since ids_peak_icv 1.1
50 """
51 return self._origin
52
53 @property
54 def x_axis(self) -> Point:
55 """!
56 @brief
57 X-axis vector of the coordinate system.
58
59 @since ids_peak_icv 1.1
60 """
61 return self._x_axis
62
63 @property
64 def y_axis(self) -> Point:
65 """!
66 @brief
67 Y-axis vector of the coordinate system.
68
69 @since ids_peak_icv 1.1
70 """
71 return self._y_axis
72
73 @property
74 def z_axis(self) -> Point:
75 """!
76 @brief
77 Z-axis vector of the coordinate system.
78
79 @since ids_peak_icv 1.1
80 """
81 return self._z_axis
82
83 def __eq__(self, other: object) -> bool:
84 """!
85 @brief
86 Check if two coordinate systems are equal.
87
88 @param other: Another CoordinateSystem object
89
90 @return True if coordinate systems are equal, False otherwise
91
92 @since ids_peak_icv 1.1
93 """
94 if not isinstance(other, CoordinateSystem):
95 return False
96
97 return (self._origin == other.origin and self._x_axis == other.x_axis
98 and self._y_axis == other.y_axis and self._z_axis == other.z_axis)
99
100 def __ne__(self, other: object) -> bool:
101 """!
102 @brief
103 Check if two coordinate systems are not equal.
104
105 @param other: Another CoordinateSystem object
106
107 @return True if coordinate systems are not equal, False otherwise
108
109 @since ids_peak_icv 1.1
110 """
111 return not self.__eq__(other)
112
113 def __repr__(self) -> str:
114 """!
115 @brief
116 Get a string representation of the CoordinateSystem.
117
118 @return String representation of the CoordinateSystem
119
120 @since ids_peak_icv 1.1
121 """
122 return f"({self._origin}, {self._x_axis}, {self._y_axis}, {self._z_axis})"
Represents the coordinate system of a calibration view that was projected into the 2D plane.
Point z_axis(self)
Z-axis vector of the coordinate system.
bool __eq__(self, object other)
Check if two coordinate systems are equal.
Point x_axis(self)
X-axis vector of the coordinate system.
Point y_axis(self)
Y-axis vector of the coordinate system.
None __init__(self, Point origin, Point x_axis, Point y_axis, Point z_axis)
Creates a coordinate system.
str __repr__(self)
Get a string representation of the CoordinateSystem.
bool __ne__(self, object other)
Check if two coordinate systems are not equal.
Thrown when a requested operation is not implemented or supported.
Definition exceptions.py:71