Geometry
Geometry data models.
Pose3D(rotation=Rotation3D_Matrix(), translation=Translation3D())
dataclass
3D pose: 3D rotation + 3D translation, a.k.a. \(SE(3)\).
Attributes:
| Name | Type | Description |
|---|---|---|
rotation |
Rotation3D
|
3D rotation. |
translation |
Translation3D
|
3D translation. |
chain(pose)
Chain two poses.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pose
|
Pose3D
|
The pose to chain. |
required |
Returns:
| Type | Description |
|---|---|
Pose3D
|
The chained pose. |
Source code in src/compas_camcal/models/geometry.py
300 301 302 303 304 305 306 307 308 309 310 | |
from_matrix(matrix)
classmethod
Initialize from a 3D homogeneous transformation matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
ndarray
|
3D homogeneous transformation matrix as a 4x4 numpy array. |
required |
Returns:
| Type | Description |
|---|---|
Pose3D
|
3D pose. |
Source code in src/compas_camcal/models/geometry.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | |
invert()
Invert the pose.
Returns:
| Type | Description |
|---|---|
Pose3D
|
The inverted pose. |
Source code in src/compas_camcal/models/geometry.py
291 292 293 294 295 296 297 298 | |
to_matrix()
Make a homogeneous transformation matrix.
Returns:
| Type | Description |
|---|---|
ndarray
|
3D homogeneous transformation matrix as a 4x4 numpy array. |
Source code in src/compas_camcal/models/geometry.py
263 264 265 266 267 268 269 270 271 272 | |
transform(points)
Transform a set of points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
ndarray
|
Points to transform as a 3xN or 4xN numpy array. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Transformed points as a 3xN or 4xN numpy array. |
Source code in src/compas_camcal/models/geometry.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
Rotation3D()
dataclass
Bases: ABC
Abstract 3D rotation, a.k.a. \(SO(3)\). Subclasses must implement the to_matrix and from_matrix methods.
as_(rotation_class)
Convert to a different rotation class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rotation_class
|
type
|
The rotation class to convert to. |
required |
Returns:
| Type | Description |
|---|---|
Rotation3D
|
The converted rotation. |
Source code in src/compas_camcal/models/geometry.py
101 102 103 104 105 106 107 108 109 110 111 | |
from_matrix(matrix)
abstractmethod
classmethod
Initialize from a rotation matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
ndarray
|
3D rotation matrix as a 3x3 numpy array. |
required |
Returns:
| Type | Description |
|---|---|
Rotation3D
|
3D rotation. |
Source code in src/compas_camcal/models/geometry.py
87 88 89 90 91 92 93 94 95 96 97 98 99 | |
to_matrix()
abstractmethod
Make a rotation matrix.
Returns:
| Type | Description |
|---|---|
ndarray
|
3D rotation matrix as a 3x3 numpy array. |
Source code in src/compas_camcal/models/geometry.py
77 78 79 80 81 82 83 84 85 | |
Rotation3D_Euler(angle_1=0.0, angle_2=0.0, angle_3=0.0)
dataclass
Bases: Rotation3D
3D rotation using Euler angles.
Attributes:
| Name | Type | Description |
|---|---|---|
angle_1 |
float
|
Angle \(\theta_1\) in radians. |
angle_2 |
float
|
Angle \(\theta_2\) in radians. |
angle_3 |
float
|
Angle \(\theta_3\) in radians. |
from_matrix(matrix)
classmethod
Initialize from a rotation matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
ndarray
|
3D rotation matrix as a 3x3 numpy array. |
required |
Returns:
| Type | Description |
|---|---|
Rotation3D_Euler
|
3D rotation. |
Source code in src/compas_camcal/models/geometry.py
165 166 167 168 169 170 171 172 173 174 175 176 | |
to_matrix()
Make a rotation matrix.
Returns:
| Type | Description |
|---|---|
ndarray
|
3D rotation matrix as a 3x3 numpy array. |
Source code in src/compas_camcal/models/geometry.py
156 157 158 159 160 161 162 163 | |
Rotation3D_Matrix(matrix=(lambda: np.eye(3))())
dataclass
Bases: Rotation3D
3D rotation using a rotation matrix.
Attributes:
| Name | Type | Description |
|---|---|---|
matrix |
ndarray
|
3D rotation matrix as a 3x3 numpy array. |
Rotation3D_Quaternion(r=1.0, i=0.0, j=0.0, k=0.0)
dataclass
Bases: Rotation3D
3D rotation using a quaternion.
Attributes:
| Name | Type | Description |
|---|---|---|
r |
float
|
Real part of the quaternion \(q_r\). |
i |
float
|
Imaginary part of the quaternion \(q_i\). |
j |
float
|
Imaginary part of the quaternion \(q_j\). |
k |
float
|
Imaginary part of the quaternion \(q_k\). |
to_matrix()
Make a rotation matrix.
Returns:
| Type | Description |
|---|---|
ndarray
|
3D rotation matrix as a 3x3 numpy array. |
Source code in src/compas_camcal/models/geometry.py
197 198 199 200 201 202 203 204 | |
Rotation3D_Rodrigues(vector=(lambda: np.zeros((3, 1)))())
dataclass
Bases: Rotation3D
3D rotation using a Rodrigues vector.
Attributes:
| Name | Type | Description |
|---|---|---|
vector |
ndarray
|
Rodrigues vector as a 3x1 numpy array. |
to_matrix()
Make a rotation matrix.
Returns:
| Type | Description |
|---|---|
ndarray
|
3D rotation matrix as a 3x3 numpy array. |
Source code in src/compas_camcal/models/geometry.py
229 230 231 232 233 234 235 236 | |
Translation3D(x=0.0, y=0.0, z=0.0)
dataclass
3D translation.
Attributes:
| Name | Type | Description |
|---|---|---|
x |
float
|
X coordinate |
y |
float
|
Y coordinate |
z |
float
|
Z coordinate |
from_vector(vector)
classmethod
Initialize from a translation vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector
|
ndarray
|
3D translation vector as a 3x1 numpy array. |
required |
Returns:
| Type | Description |
|---|---|
Translation3D
|
3D translation. |
Source code in src/compas_camcal/models/geometry.py
56 57 58 59 60 61 62 63 64 65 66 67 | |
to_vector()
Make a translation column vector of the form:
Returns:
| Type | Description |
|---|---|
ndarray
|
3D translation vector as a 3x1 numpy array. |
Source code in src/compas_camcal/models/geometry.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |