(sim3d: Sim3d)
| 285 | * The matrix can be applied to a Three.js group to transform all children. |
| 286 | */ |
| 287 | export function sim3dToMatrix4(sim3d: Sim3d): THREE.Matrix4 { |
| 288 | const matrix = new THREE.Matrix4(); |
| 289 | |
| 290 | // Compose: translation * rotation * scale |
| 291 | // THREE.Matrix4.compose(position, quaternion, scale) |
| 292 | matrix.compose( |
| 293 | sim3d.translation, |
| 294 | sim3d.rotation, |
| 295 | new THREE.Vector3(sim3d.scale, sim3d.scale, sim3d.scale) |
| 296 | ); |
| 297 | |
| 298 | return matrix; |
| 299 | } |
| 300 | |
| 301 | /** |
| 302 | * Check if a Sim3dEuler represents an identity transform. |
no outgoing calls
no test coverage detected