How do I get Rotation degrees back after decompose?

I’m having trouble getting the value from the degree back.

  const radians = 135 * (180 / Math.PI);
  model.matrix.setPlacementTransform(
      new THREE.Matrix4().compose(
        new THREE.Vector3(position[0] ?? 0, position[1] ?? 0, position[2] ?? 0),
        new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 0, 1), radians);
        new THREE.Vector3(1, 1, 1)
      )
    );

Decompose

let translation = new THREE.Vector3(),
    rotation = new THREE.Quaternion(),
      scale = new THREE.Vector3();
    model.matrix.decompose(translation, rotation, scale);

image

How do I parse these Quaternion value to degree ?

You can’t convert a quaternion in a single angle value. A quaternion is one way to express orientation in 3D space. Alternatives are rotation matrices, euler angles or the axis-angle approach that you have used in your first code snippet to setup the quaternion.

Your probably have to convert the quaterion back to the axis-angle representation like so:

https://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm

Thank you for the formula. I solved it 

const degree = 135

const matrix = new THREE.Matrix4()

const rotated = matrix.makeRotationZ(degree * (Math.PI / 180));

let vec = new THREE.Quaternion();

vec.setFromRotationMatrix(rotated);

const test2 = vec._w

const test3 = 2* Math.acos(test2)

const radToDegree = (test3 * 180) /Math.PI

console.log(radToDegree)