Пример #1
0
 public Mat4f Multiply(Mat4f matrix)
 {
     return(new Mat4f(new[, ]
     {
         {
             this[1, 1] * matrix[1, 1] + this[1, 2] * matrix[2, 1] + this[1, 3] * matrix[3, 1] +
             this[1, 4] * matrix[4, 1],
             this[1, 1] * matrix[1, 2] + this[1, 2] * matrix[2, 2] + this[1, 3] * matrix[3, 2] +
             this[1, 4] * matrix[4, 2],
             this[1, 1] * matrix[1, 3] + this[1, 2] * matrix[2, 3] + this[1, 3] * matrix[3, 3] +
             this[1, 4] * matrix[4, 3],
             this[1, 1] * matrix[1, 4] + this[1, 2] * matrix[2, 4] + this[1, 3] * matrix[3, 4] +
             this[1, 4] * matrix[4, 4]
         },
         {
             this[2, 1] * matrix[1, 1] + this[2, 2] * matrix[2, 1] + this[2, 3] * matrix[3, 1] +
             this[2, 4] * matrix[4, 1],
             this[2, 1] * matrix[1, 2] + this[2, 2] * matrix[2, 2] + this[2, 3] * matrix[3, 2] +
             this[2, 4] * matrix[4, 2],
             this[2, 1] * matrix[1, 3] + this[2, 2] * matrix[2, 3] + this[2, 3] * matrix[3, 3] +
             this[2, 4] * matrix[4, 3],
             this[2, 1] * matrix[1, 4] + this[2, 2] * matrix[2, 4] + this[2, 3] * matrix[3, 4] +
             this[2, 4] * matrix[4, 4]
         },
         {
             this[3, 1] * matrix[1, 1] + this[3, 2] * matrix[2, 1] + this[3, 3] * matrix[3, 1] +
             this[3, 4] * matrix[4, 1],
             this[3, 1] * matrix[1, 2] + this[3, 2] * matrix[2, 2] + this[3, 3] * matrix[3, 2] +
             this[3, 4] * matrix[4, 2],
             this[3, 1] * matrix[1, 3] + this[3, 2] * matrix[2, 3] + this[3, 3] * matrix[3, 3] +
             this[3, 4] * matrix[4, 3],
             this[3, 1] * matrix[1, 4] + this[3, 2] * matrix[2, 4] + this[3, 3] * matrix[3, 4] +
             this[3, 4] * matrix[4, 4]
         },
         {
             this[4, 1] * matrix[1, 1] + this[4, 2] * matrix[2, 1] + this[4, 3] * matrix[3, 1] +
             this[4, 4] * matrix[4, 1],
             this[4, 1] * matrix[1, 2] + this[4, 2] * matrix[2, 2] + this[4, 3] * matrix[3, 2] +
             this[4, 4] * matrix[4, 2],
             this[4, 1] * matrix[1, 3] + this[4, 2] * matrix[2, 3] + this[4, 3] * matrix[3, 3] +
             this[4, 4] * matrix[4, 3],
             this[4, 1] * matrix[1, 4] + this[4, 2] * matrix[2, 4] + this[4, 3] * matrix[3, 4] +
             this[4, 4] * matrix[4, 4]
         }
     }));
 }
Пример #2
0
 public Mat4f Subtract(Mat4f matrix)
 {
     return(new Mat4f(new[, ]
     {
         {
             this[1, 1] - matrix[1, 1], this[1, 2] - matrix[1, 2], this[1, 3] - matrix[1, 3],
             this[1, 4] - matrix[1, 4]
         },
         {
             this[2, 1] - matrix[2, 1], this[2, 2] - matrix[2, 2], this[2, 3] - matrix[2, 3],
             this[2, 4] - matrix[2, 4]
         },
         {
             this[3, 1] - matrix[3, 1], this[3, 2] - matrix[3, 2], this[3, 3] - matrix[3, 3],
             this[3, 4] - matrix[3, 4]
         },
         {
             this[4, 1] - matrix[4, 1], this[4, 2] - matrix[4, 2], this[4, 3] - matrix[4, 3],
             this[4, 4] - matrix[4, 4]
         }
     }));
 }
Пример #3
0
 public Mat4f Add(Mat4f matrix)
 {
     return(new Mat4f(new[, ]
     {
         {
             this[1, 1] + matrix[1, 1], this[1, 2] + matrix[1, 2], this[1, 3] + matrix[1, 3],
             this[1, 4] + matrix[1, 4]
         },
         {
             this[2, 1] + matrix[2, 1], this[2, 2] + matrix[2, 2], this[2, 3] + matrix[2, 3],
             this[2, 4] + matrix[2, 4]
         },
         {
             this[3, 1] + matrix[3, 1], this[3, 2] + matrix[3, 2], this[3, 3] + matrix[3, 3],
             this[3, 4] + matrix[3, 4]
         },
         {
             this[4, 1] + matrix[4, 1], this[4, 2] + matrix[4, 2], this[4, 3] + matrix[4, 3],
             this[4, 4] + matrix[4, 4]
         }
     }));
 }