| 186 | } |
| 187 | |
| 188 | void PropertyNormalList::transformGeometry(const Base::Matrix4D& mat) |
| 189 | { |
| 190 | // A normal vector is only a direction with unit length, so we only need to rotate it |
| 191 | // (no translations or scaling) |
| 192 | |
| 193 | // Extract scale factors (assumes an orthogonal rotation matrix) |
| 194 | // Use the fact that the length of the row vectors of R are all equal to 1 |
| 195 | // And that scaling is applied after rotating |
| 196 | double s[3]; |
| 197 | s[0] = sqrt(mat[0][0] * mat[0][0] + mat[0][1] * mat[0][1] + mat[0][2] * mat[0][2]); |
| 198 | s[1] = sqrt(mat[1][0] * mat[1][0] + mat[1][1] * mat[1][1] + mat[1][2] * mat[1][2]); |
| 199 | s[2] = sqrt(mat[2][0] * mat[2][0] + mat[2][1] * mat[2][1] + mat[2][2] * mat[2][2]); |
| 200 | |
| 201 | // Set up the rotation matrix: zero the translations and make the scale factors = 1 |
| 202 | Base::Matrix4D rot; |
| 203 | rot.setToUnity(); |
| 204 | for (unsigned short i = 0; i < 3; i++) { |
| 205 | for (unsigned short j = 0; j < 3; j++) { |
| 206 | rot[i][j] = mat[i][j] / s[i]; |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | aboutToSetValue(); |
| 211 | |
| 212 | // Rotate the normal vectors |
| 213 | for (int ii = 0; ii < getSize(); ii++) { |
| 214 | set1Value(ii, rot * operator[](ii)); |
| 215 | } |
| 216 | |
| 217 | hasSetValue(); |
| 218 | } |
| 219 | |
| 220 | // ---------------------------------------------------------------------------- |
| 221 |
nothing calls this directly
no test coverage detected