Rotating transformation - Calculation

Hello,

In another program (which somebody else made) there is defined, how i have to rotate my 3D-Objects in my Browser-App. In that program (of somebody else) the default room coordinates are f.e. defined like:
X_X: 1
X_Y: 0 first vector
X_Z: 0

Y_X: 0
Y_Y: 1 second vector
Y_Z: 0

Z_X: 0
Z_Y: 0 third vector
Z_Z: 1

So if now an object with Three.js rotation (0,0,0) is spawning, it has the same coordinates as the normal room coordinates above.
Now i get some information, that i have to rotate my object to (just as example):

X_X: 0
X_Y: 0 first vector
X_Z: 1

Y_X: 0
Y_Y: -1 second vector
Y_Z: 0

Z_X: 1
Z_Y: 0 third vector
Z_Z: 0

Is there some easy way or function i could use to calculate values out of these vectors to set the object.rotation in my Three.js program? There should be a mathematical algorithm but i can’t find it.
Probably i need a matrix transformation or something to get an Euler out of it…

this is how you get Euler angles in radians from a 2 point vector in a 3d space

getEuler3D: function (pA, pB) {
    // Set starting and ending vectors
    var myVector = new THREE.Vector3(pA.x, pA.y, pA.z);
    var targetVector = new THREE.Vector3(pB.x, pB.y, pB.z);

    // Normalize vectors to make sure they have a length of 1
    myVector.normalize();
    targetVector.normalize();
    // console.log("myVector Normalized: ", myVector);

    var euler = new THREE.Euler();

    if(myVector.x === targetVector.x && myVector.y === targetVector.y && myVector.z === targetVector.z ){
        console.log(':. USE ioiM.getEuler2D - Both Vectors have the same Normal.');
    } else {
        // Create a quaternion, and apply starting, then ending vectors
        var quaternion = new THREE.Quaternion();
        quaternion.setFromUnitVectors(myVector, targetVector);
        //console.log("quaternion ", quaternion);

        // Quaternion now has rotation data within it.
        // We'll need to get it out with a THREE.Euler()
        // var euler = new THREE.Euler();
        euler.setFromQuaternion(quaternion);
        //console.log(euler.toArray());

        return euler;
    }
    // Resulting euler will have x, y, z rotations in radians:
    //[
    //  0: -1.6704649792860586,
    //  1: 0.09917726107940236,
    //  2: 0.10956980436233299,
    //  3: "XYZ"
    //]
},
1 Like

Ok, i am not sure if i can transform my 9 vectors in 2… Is this correct?:
First picture vector (1,1,1) and the second picture vector (1,-1,1).
Will this get me the rotation i need?

Btw. another question: I can rotate my object around the center of my geometry with “geometry.center()”.
Is there an option to rotate the object around a point inside the object?

that i do not know, i tought you were looking to find Euler angles from an vector