| 1 | import * as THREE from "three"; |
| 2 | |
| 3 | export class MathUtils { |
| 4 | static basisFromEuler(rotation: THREE.Euler) { |
| 5 | const dirs = new THREE.Matrix4(); |
| 6 | dirs.makeRotationFromEuler(rotation); |
| 7 | const dirX = new THREE.Vector3(); |
| 8 | const dirY = new THREE.Vector3(); |
| 9 | const dirZ = new THREE.Vector3(); |
| 10 | dirs.extractBasis(dirX, dirY, dirZ); |
| 11 | return { dirX, dirY, dirZ }; |
| 12 | } |
| 13 | |
| 14 | static toThreeCoords(value: THREE.Vector3) { |
| 15 | return value.clone().set(value.x, value.z, -value.y); |
| 16 | } |
| 17 | |
| 18 | static toIfcCoords(value: THREE.Vector3) { |
| 19 | return value.clone().set(value.x, -value.z, value.y); |
| 20 | } |
| 21 | |
| 22 | static toThreeRot(value: THREE.Euler) { |
| 23 | return value.clone().set(value.x, value.z, -value.y); |
| 24 | } |
| 25 | |
| 26 | static toIfcRot(value: THREE.Euler) { |
| 27 | return value.clone().set(value.x, -value.z, value.y); |
| 28 | } |
| 29 | } |
nothing calls this directly
no outgoing calls
no test coverage detected