public static Multiply ( |
||
left | left matrix | |
right | right matrix | |
return |
/// <summary> /// calculate the matrix used to transform 2D to 3D /// </summary> /// <returns>maxtrix is use to transform 2d points to 3d</returns> public Matrix4 Get2DTo3DMatrix() { Matrix4 matrix = Matrix4.Multiply( new Matrix4(new Vector4(-192, -137, 0)), m_scaleMatrix.Inverse()); matrix = Matrix4.Multiply(matrix, m_moveToCenterMatrix); return(Matrix4.Multiply(matrix, m_to2DMatrix)); }
/// <summary> /// calculate the matrix used to transform 3D to 2D /// </summary> /// <returns>maxtrix is use to transform 3d points to 2d</returns> public Matrix4 Get3DTo2DMatrix() { Matrix4 result = Matrix4.Multiply( m_to2DMatrix.Inverse(), m_moveToCenterMatrix.Inverse()); result = Matrix4.Multiply(result, m_scaleMatrix); return(Matrix4.Multiply(result, new Matrix4(new Vector4(192, 137, 0)))); }
/// <summary> /// calculate the matrix used to transform 2d points (on pictureBox) to the plane of truss /// which use to set profile /// </summary> /// <returns>maxtrix is use to transform 2d points to the plane of truss</returns> public Matrix4 Get2DToTrussProfileMatrix() { Matrix4 matrix = Matrix4.Multiply( new Matrix4(new Vector4(-192, -137, 0)), m_scaleMatrix.Inverse()); return(Matrix4.Multiply(matrix, m_moveToCenterMatrix)); ////downward in picture box, so rotate upward here, y = -y //Matrix4 upward = new Matrix4(new Vector4(new Autodesk.Revit.DB.XYZ (1, 0, 0)), // new Vector4(new Autodesk.Revit.DB.XYZ (0, -1, 0)), new Vector4(new Autodesk.Revit.DB.XYZ (0, 0, 1))); //return Matrix4.Multiply(matrix, upward); }