Matrix used to transform between ucs coordinate and world coordinate.
Esempio n. 1
0
 /// <summary>
 /// Calculate geometry info for truss
 /// </summary>
 private void GetTrussGeometryInfo()
 {
     // get the start and end point of the basic line of the truss
     m_points = GetTrussPoints();
     // Get a matrix which can transform points to 2D
     m_to2DMatrix = GetTo2DMatrix();
     // get the boundary of all the points
     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();
     // transform from 2D (on picture box) to truss profile plane
     m_2DToTrussProfileMatrix = Get2DToTrussProfileMatrix();
     // create the graphics path which contains all the lines
     CreateGraphicsPath();
 }
Esempio n. 2
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;
 }