コード例 #1
0
ファイル: Matrix4Extension.cs プロジェクト: whigg/PointClouds
        //public static Matrix3 ExtractMatrix3(this Matrix4 mat4)
        //{

        //    Matrix3 mat3d = new Matrix3();
        //    for (int i = 0; i < 3; i++)
        //    {
        //        for (int j = 0; j < 3; j++)
        //            mat3d[i, j] = mat4[i, j];
        //    }
        //    return mat3d;

        //}
        public static Matrix4 PutTheMatrix4together(this Matrix4 mat4d, Vector3 T, Matrix3 Rotation)
        {
            //put the 4d matrix together
            Matrix3 r3D      = Rotation.Clone();
            Matrix4 myMatrix = new Matrix4();

            myMatrix       = myMatrix.FromMatrix3(r3D);
            myMatrix[0, 3] = T.X;
            myMatrix[1, 3] = T.Y;
            myMatrix[2, 3] = T.Z;
            myMatrix[3, 3] = 1f;

            return(myMatrix);
        }