Skip to content

Commit

Permalink
feat: add static methods to upgrade threejs objects to their arx-leve…
Browse files Browse the repository at this point in the history
…l-generator counterparts
  • Loading branch information
meszaros-lajos-gyorgy committed Sep 13, 2023
1 parent 3324b77 commit ffe744f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Rotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export class Rotation extends Euler {
return new Rotation(MathUtils.degToRad(a), MathUtils.degToRad(b), MathUtils.degToRad(g), 'XYZ')
}

static fromThreeJsEuler(euler: Euler) {
return new Rotation(euler.x, euler.y, euler.z)
}

reorder(newOrder: EulerOrder) {
const { x, y, z } = super.reorder(newOrder)

Expand Down
4 changes: 4 additions & 0 deletions src/Vector3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export class Vector3 extends ThreeJsVector3 {
return new Vector3(parseFloat(x) || 0, parseFloat(y) || 0, parseFloat(z) || 0)
}

static fromThreeJsVector3(vector: ThreeJsVector3) {
return new Vector3(vector.x, vector.y, vector.z)
}

toArxVector3(): ArxVector3 {
return { x: this.x, y: this.y, z: this.z }
}
Expand Down

0 comments on commit ffe744f

Please sign in to comment.