Transform() public method

transform point using this matrix
public Transform ( Vector4 point ) : Vector4
point Vector4 point to be transformed
return Vector4
Esempio n. 1
0
        /// <summary>
        /// draw profile of truss in pictureBox
        /// </summary>
        /// <param name="graphics">form graphic</param>
        /// <param name="pen">pen used to draw line in pictureBox</param>
        public void Draw2D(Graphics graphics, Pen pen)
        {
            //draw truss curves
            for (int i = 0; i < m_points.Count - 1; i += 2)
            {
                Autodesk.Revit.DB.XYZ point1 = m_points[i];
                Autodesk.Revit.DB.XYZ point2 = m_points[i + 1];

                Vector4 v1 = new Vector4(point1);
                Vector4 v2 = new Vector4(point2);

                v1 = m_transformMatrix.Transform(v1);
                v2 = m_transformMatrix.Transform(v2);
                graphics.DrawLine(pen, new Point((int)v1.X, (int)v1.Y),
                                  new Point((int)v2.X, (int)v2.Y));
            }
            //draw selected beam (line) by red pen
            DrawSelectedLineRed(graphics);

            //draw top chord and bottom chord
            m_topChord.Draw2D(graphics, Pens.Red);
            m_bottomChord.Draw2D(graphics, Pens.Black);
        }
Esempio n. 2
0
        /// <summary>
        /// Get max and min coordinates of all points
        /// </summary>
        /// <returns>points array stores the bound of all points</returns>
        public Autodesk.Revit.DB.XYZ[] GetBoundsPoints()
        {
            Matrix4 matrix = m_to2DMatrix;
            Matrix4 inverseMatrix = matrix.Inverse();
            double  minX = 0, maxX = 0, minY = 0, maxY = 0;
            bool    bFirstPoint = true;

            //get the max and min point on the face
            foreach (Autodesk.Revit.DB.XYZ point in m_points)
            {
                Vector4 v  = new Vector4(point);
                Vector4 v1 = inverseMatrix.Transform(v);

                if (bFirstPoint)
                {
                    minX        = maxX = v1.X;
                    minY        = maxY = v1.Y;
                    bFirstPoint = false;
                }
                else
                {
                    if (v1.X < minX)
                    {
                        minX = v1.X;
                    }
                    else if (v1.X > maxX)
                    {
                        maxX = v1.X;
                    }

                    if (v1.Y < minY)
                    {
                        minY = v1.Y;
                    }
                    else if (v1.Y > maxY)
                    {
                        maxY = v1.Y;
                    }
                }
            }
            //return an array with max and min value of all points
            Autodesk.Revit.DB.XYZ[] resultPoints = new Autodesk.Revit.DB.XYZ[2] {
                new Autodesk.Revit.DB.XYZ(minX, minY, 0), new Autodesk.Revit.DB.XYZ(maxX, maxY, 0)
            };
            return(resultPoints);
        }