Transform() public method

transform point use this matrix
public Transform ( Vector4 point ) : Vector4
point Vector4 point needed to be transformed
return Vector4
Exemplo n.º 1
0
        /// <summary>
        /// Compute the bound of the curves of path reinforcement.
        /// </summary>
        private void ComputeBound()
        {
            //make the bound
            Autodesk.Revit.DB.UV min = m_box.get_Bounds(0);
            Autodesk.Revit.DB.UV max = m_box.get_Bounds(1);

            Matrix4 transform = GetActiveViewMatrix().Inverse();

            bool isFirst = true;

            foreach (List <XYZ> arr in m_curves)
            {
                List <UV> uvarr = new List <UV>();
                foreach (Autodesk.Revit.DB.XYZ xyz in arr)
                {
                    Vector4 tmpVector          = transform.Transform(new Vector4(xyz));
                    Autodesk.Revit.DB.UV tmpUv = new Autodesk.Revit.DB.UV(
                        tmpVector.X,
                        tmpVector.Y);
                    uvarr.Add(tmpUv);

                    if (isFirst)
                    {
                        isFirst = false;
                        min     = new UV(tmpUv.U, tmpUv.V);
                        max     = new UV(tmpUv.U, tmpUv.V);
                    }
                    if (tmpUv.U < min.U)
                    {
                        min = new UV(tmpUv.U, min.V);
                    }
                    else if (tmpUv.U > max.U)
                    {
                        max = new UV(tmpUv.U, max.V);
                    }
                    if (tmpUv.V < min.V)
                    {
                        min = new UV(min.U, tmpUv.V);
                    }
                    else if (tmpUv.V > max.V)
                    {
                        max = new UV(max.U, tmpUv.V);
                    }
                }
                m_point2d.Add(uvarr);
            }
            m_box.Min = min;
            m_box.Max = max;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Transform 3d path to 2d path.
        /// </summary>
        /// <returns></returns>
        private void ComputePathTo2D()
        {
            Matrix4 transform = GetActiveViewMatrix().Inverse();

            foreach (List <XYZ> arr in m_path)
            {
                List <UV> uvarr = new List <UV>();
                foreach (Autodesk.Revit.DB.XYZ xyz in arr)
                {
                    Vector4 tmpVector          = transform.Transform(new Vector4(xyz));
                    Autodesk.Revit.DB.UV tmpUv = new Autodesk.Revit.DB.UV(
                        tmpVector.X,
                        tmpVector.Y);
                    uvarr.Add(tmpUv);
                }
                m_path2d.Add(uvarr);
            }
        }