MCPcopy Create free account
hub / github.com/ThatOpen/engine_clay / MathUtils

Class MathUtils

packages/clay/src/utils/math-utils.ts:3–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1import * as THREE from "three";
2
3export 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected