示例#1
0
 /// <summary>
 ///		Used to subtract two matrices.
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <returns></returns>
 public static Matrix3D Subtract(Matrix3D left, Matrix3D right)
 {
     return left - right;
 }
示例#2
0
 /// <summary>
 ///    Constructs this Matrix from 3 euler angles, in degrees.
 /// </summary>
 /// <param name="yaw"></param>
 /// <param name="pitch"></param>
 /// <param name="roll"></param>
 public void FromEulerAnglesXYZ(float yaw, float pitch, float roll)
 {
     double cos = Math.Cos(yaw);
     double sin = Math.Sin(yaw);
     Matrix3D xMat = new Matrix3D(1, 0, 0, 0, (float) cos, (float) -sin, 0, (float) sin, (float) cos);
     cos = Math.Cos(pitch);
     sin = Math.Sin(pitch);
     Matrix3D yMat = new Matrix3D((float) cos, 0, (float) sin, 0, 1, 0, (float) -sin, 0, (float) cos);
     cos = Math.Cos(roll);
     sin = Math.Sin(roll);
     Matrix3D zMat = new Matrix3D((float) cos, (float) -sin, 0, (float) sin, (float) cos, 0, 0, 0, 1);
     this = xMat * (yMat * zMat);
 }
示例#3
0
 /// <summary>
 /// Multiplies all the items in the Matrix3D by a scalar value.
 /// </summary>
 /// <param name="matrix"></param>
 /// <param name="scalar"></param>
 /// <returns></returns>
 public static Matrix3D Multiply(float scalar, Matrix3D matrix)
 {
     return scalar * matrix;
 }
示例#4
0
 /// <summary>
 /// Negates all the items in the Matrix.
 /// </summary>
 /// <param name="matrix"></param>
 /// <returns></returns>
 public static Matrix3D Negate(Matrix3D matrix)
 {
     return -matrix;
 }
示例#5
0
 public static Point3D Multiply(Matrix3D matrix, Point3D point)
 {
     return (matrix * point);
 }
示例#6
0
 /// <summary>
 /// Multiplies all the items in the Matrix3D by a scalar value.
 /// </summary>
 /// <param name="matrix"></param>
 /// <param name="scalar"></param>
 /// <returns></returns>
 public static Matrix3D Multiply(Matrix3D matrix, float scalar)
 {
     return matrix * scalar;
 }
示例#7
0
 public static Point3D Multiply(Point3D point, Matrix3D matrix)
 {
     return point * matrix;
 }
示例#8
0
 /// <summary>
 ///		matrix * vector [3x3 * 3x1 = 3x1]
 /// </summary>
 /// <param name="vector"></param>
 /// <param name="matrix"></param>
 /// <returns></returns>
 public static Vector3D Multiply(Matrix3D matrix, Vector3D vector)
 {
     return (matrix * vector);
 }
示例#9
0
 /// <summary>
 /// Multiply (concatenate) two Matrix3D instances together.
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <returns></returns>
 public static Matrix3D Multiply(Matrix3D left, Matrix3D right)
 {
     return left * right;
 }
示例#10
0
 /// <summary>
 ///		vector * matrix [1x3 * 3x3 = 1x3]
 /// </summary>
 /// <param name="vector"></param>
 /// <param name="matrix"></param>
 /// <returns></returns>
 public static Vector3D Multiply(Vector3D vector, Matrix3D matrix)
 {
     return vector * matrix;
 }
示例#11
0
 /// <summary>
 ///		Used to add two matrices together.
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <returns></returns>
 public static Matrix3D Add(Matrix3D left, Matrix3D right)
 {
     return left + right;
 }
示例#12
0
 /// <summary>
 /// Negates all the items in the Matrix.
 /// </summary>
 /// <param name="matrix"></param>
 /// <returns></returns>
 public static Matrix3D operator -(Matrix3D matrix)
 {
     Matrix3D result = new Matrix3D();
     result.M00 = -matrix.M00;
     result.M01 = -matrix.M01;
     result.M02 = -matrix.M02;
     result.M10 = -matrix.M10;
     result.M11 = -matrix.M11;
     result.M12 = -matrix.M12;
     result.M20 = -matrix.M20;
     result.M21 = -matrix.M21;
     result.M22 = -matrix.M22;
     return result;
 }
示例#13
0
 /// <summary>
 ///		Used to subtract two matrices.
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <returns></returns>
 public static Matrix3D operator -(Matrix3D left, Matrix3D right)
 {
     Matrix3D result = new Matrix3D();
     for (int row = 0; row < 3; row++) {
         for (int col = 0; col < 3; col++) {
             result[row, col] = left[row, col] - right[row, col];
         }
     }
     return result;
 }
示例#14
0
 /// <summary>
 /// Multiplies all the items in the Matrix3D by a scalar value.
 /// </summary>
 /// <param name="matrix"></param>
 /// <param name="scalar"></param>
 /// <returns></returns>
 public static Matrix3D operator *(float scalar, Matrix3D matrix)
 {
     Matrix3D result = new Matrix3D();
     result.M00 = matrix.M00 * scalar;
     result.M01 = matrix.M01 * scalar;
     result.M02 = matrix.M02 * scalar;
     result.M10 = matrix.M10 * scalar;
     result.M11 = matrix.M11 * scalar;
     result.M12 = matrix.M12 * scalar;
     result.M20 = matrix.M20 * scalar;
     result.M21 = matrix.M21 * scalar;
     result.M22 = matrix.M22 * scalar;
     return result;
 }
示例#15
0
 /// <summary>
 /// Multiply (concatenate) two Matrix3D instances together.
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <returns></returns>
 public static Matrix3D operator *(Matrix3D left, Matrix3D right)
 {
     Matrix3D result = new Matrix3D();
     result.M00 = left.M00 * right.M00 + left.M01 * right.M10 + left.M02 * right.M20;
     result.M01 = left.M00 * right.M01 + left.M01 * right.M11 + left.M02 * right.M21;
     result.M02 = left.M00 * right.M02 + left.M01 * right.M12 + left.M02 * right.M22;
     result.M10 = left.M10 * right.M00 + left.M11 * right.M10 + left.M12 * right.M20;
     result.M11 = left.M10 * right.M01 + left.M11 * right.M11 + left.M12 * right.M21;
     result.M12 = left.M10 * right.M02 + left.M11 * right.M12 + left.M12 * right.M22;
     result.M20 = left.M20 * right.M00 + left.M21 * right.M10 + left.M22 * right.M20;
     result.M21 = left.M20 * right.M01 + left.M21 * right.M11 + left.M22 * right.M21;
     result.M22 = left.M20 * right.M02 + left.M21 * right.M12 + left.M22 * right.M22;
     return result;
 }