Matrix used to transform between ucs coordinate and world coordinate.
Example #1
0
 /// <summary>
 ///  multiply matrix left and right
 /// </summary>
 /// <param name="left">left matrix</param>
 /// <param name="right">right matrix</param>
 /// <returns></returns>
 public static Matrix4 Multiply(Matrix4 left, Matrix4 right)
 {
     Matrix4 result = new Matrix4();
      for (int i = 0; i < 4; i++)
      {
     for (int j = 0; j < 4; j++)
     {
        result[i, j] = left[i, 0] * right[0, j] + left[i, 1] * right[1, j]
            + left[i, 2] * right[2, j] + left[i, 3] * right[3, j];
     }
      }
      return result;
 }
Example #2
0
        /// <summary>
        /// obtain the matrixes used in this dialog
        /// </summary>
        public void GetMatrix()
        {
            // initialize the class members, obtain the location information of the canvas
             m_boundary = m_drawing.Boundary;
             m_center = m_drawing.Center;

             // Get a matrix which can transform points to 2D
             m_to2DMatrix = GetTo2DMatrix();

             // get the vertexes of the canvas (in Point/PointF format)
             m_boundPoints = GetBoundsPoints();

             // get a matrix which can keep all the points in the center of the canvas
             m_moveToCenterMatrix = GetMoveToCenterMatrix();

             // get a matrix for scaling all the points and lines within the canvas
             m_scaleMatrix = GetScaleMatrix();

             // transform 3D points to 2D
             m_transformMatrix = Get3DTo2DMatrix();

             // transform from 2D to 3D
             m_restoreMatrix = Get2DTo3DMatrix();
        }