Geometry
Geometric utilities.
compose_homogeneous_transform(translation, rotation)
Compose a homogeneous transform from a translation column vector \(\mathbf{t}\) and rotation matrix \(\mathbf{R}\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
translation
|
ndarray
|
The translation \(\mathbf{t}\) as a 3x1 numpy array. |
required |
rotation
|
ndarray
|
The rotation \(\mathbf{R}\) as a 3x3 numpy array. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The homogeneous transform \(\mathbf{T}\) as a 4x4 numpy array. |
Source code in src/compas_camcal/util/geometry.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
decompose_homogeneous_transform(transform)
Decompose a homogeneous transform into a translation column vector \(\mathbf{t}\) and a rotation matrix \(\mathbf{R}\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transform
|
ndarray
|
The homogeneous transform \(\mathbf{T}\) as a 4x4 numpy array. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The translation \(\mathbf{t}\) as a 3x1 numpy array. |
ndarray
|
The rotation \(\mathbf{R}\) as a 3x3 numpy array. |
Source code in src/compas_camcal/util/geometry.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |
euler_to_rotation_matrix(angle_1, angle_2, angle_3)
Convert Euler angles to a rotation matrix.
This function follows the Tait-Bryan angles convention:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle_1
|
float
|
\(\theta_1\) (for \(\mathbf{Z}_1\)) |
required |
angle_2
|
float
|
\(\theta_2\) (for \(\mathbf{Y}_2\)) |
required |
angle_3
|
float
|
\(\theta_3\) (for \(\mathbf{X}_3\)) |
required |
Source code in src/compas_camcal/util/geometry.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
quaternion_to_rotation_matrix(r, i, j, k)
Convert a quaternion \(\mathbf{q} = q_r + q_i \mathbf{i} + q_j \mathbf{j} + q_k \mathbf{k}\) to a rotation matrix.
Directly computes:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float
|
The real part of the quaternion \(q_r\). |
required |
i
|
float
|
The imaginary part of the quaternion \(q_i\). |
required |
j
|
float
|
The imaginary part of the quaternion \(q_j\). |
required |
k
|
float
|
The imaginary part of the quaternion \(q_k\). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The rotation matrix \(\mathbf{R}\) as a 3x3 numpy array. |
Source code in src/compas_camcal/util/geometry.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
rotation_matrix_to_euler(matrix)
Convert a rotation matrix to Euler angles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
ndarray
|
The rotation matrix \(\mathbf{R}\) as a 3x3 numpy array. |
required |
Returns:
| Type | Description |
|---|---|
float
|
\(\theta_1\) |
float
|
\(\theta_2\) |
float
|
\(\theta_3\) |
Source code in src/compas_camcal/util/geometry.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
rotation_matrix_to_quaternion(matrix)
Convert a rotation matrix to a quaternion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
ndarray
|
The rotation matrix \(\mathbf{R}\) as a 3x3 numpy array. |
required |
Returns:
| Type | Description |
|---|---|
float
|
\(q_r\) |
float
|
\(q_i\) |
float
|
\(q_j\) |
float
|
\(q_k\) |
Source code in src/compas_camcal/util/geometry.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
x_rotation_matrix(angle)
Create a rotation matrix about the x-axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
float
|
The angle \(\theta\) in radians. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The rotation matrix \(\mathbf{X}\) as a 3x3 numpy array. |
Source code in src/compas_camcal/util/geometry.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
y_rotation_matrix(angle)
Create a rotation matrix about the y-axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
float
|
The angle \(\theta\) in radians. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The rotation matrix \(\mathbf{Y}\) as a 3x3 numpy array. |
Source code in src/compas_camcal/util/geometry.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
z_rotation_matrix(angle)
Create a rotation matrix about the z-axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
float
|
The angle \(\theta\) in radians. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The rotation matrix \(\mathbf{Z}\) as a 3x3 numpy array. |
Source code in src/compas_camcal/util/geometry.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |