private void Start()
    {
        var angleContainer = new Coordinate(1, 1, 1, 0);
        var rotationMatrixFromEulerAngles = RotateMath.GetRotationMatrixFromEulerAngles(angleContainer);

        _wAngle       = RotateMath.ExtractAngle(rotationMatrixFromEulerAngles);
        _rotationAxis = RotateMath.ExtractRotationAxis(rotationMatrixFromEulerAngles);
        var rotateLabQuaternion = RotateMath.Quaternion(_rotationAxis, _wAngle);
        var unityQuaternion     = Quaternion.AngleAxis(_wAngle, _rotationAxis.GetAsVector3());

        Debug.Log("RotateLab quaternion is: " + rotateLabQuaternion);
        Debug.Log("Unity quaternion is: " + unityQuaternion.x + ", " + unityQuaternion.y + ", " + unityQuaternion.z + ", " + unityQuaternion.w);
    }
Beispiel #2
0
    void Start()
    {
        var rotationMatrix = RotateMath.GetRotationMatrixFromEulerAngles(new Coordinate(_anglesContainer, 0));

        Debug.Log(rotationMatrix);
        var extractedRotationAxis = RotateMath.ExtractRotationAxis(rotationMatrix);
        var extractedAngle        = RotateMath.ExtractAngle(rotationMatrix);
        var quaternionCoord       = RotateMath.Quaternion(extractedRotationAxis, extractedAngle);

        quaternion = new Quaternion(quaternionCoord.X, quaternionCoord.Y, quaternionCoord.Z, quaternionCoord.W);
        var line = new Line(new Coordinate(0, 0, 0, 1), extractedRotationAxis.GetAsVector3() * 5);

        line.Draw(0.1f, Color.red);
    }