Accord.Math.Matrix4x4.CreateFromRotation C# (CSharp) Method

CreateFromRotation() public static method

Creates 4x4 tranformation matrix from 3x3 rotation matrix.

The source 3x3 rotation matrix is copied into the top left corner of the result 4x4 matrix, i.e. it represents 0th, 1st and 2nd row/column. The V33 element is set to 1 and the rest elements of 3rd row and 3rd column are set to zeros.

public static CreateFromRotation ( Matrix3x3 rotationMatrix ) : Matrix4x4
rotationMatrix Matrix3x3 Source 3x3 rotation matrix.
return Matrix4x4
        public static Matrix4x4 CreateFromRotation(Matrix3x3 rotationMatrix)
        {
            Matrix4x4 m = Matrix4x4.Identity;

            m.V00 = rotationMatrix.V00;
            m.V01 = rotationMatrix.V01;
            m.V02 = rotationMatrix.V02;

            m.V10 = rotationMatrix.V10;
            m.V11 = rotationMatrix.V11;
            m.V12 = rotationMatrix.V12;

            m.V20 = rotationMatrix.V20;
            m.V21 = rotationMatrix.V21;
            m.V22 = rotationMatrix.V22;

            return m;
        }