Exemplo n.º 1
0
        static Vector3d newlen = new Vector3d(); // for calculating the radius of this poly

        #endregion Fields

        #region Constructors

        public Polygon()
        {
            m_normal = new Vector3d();
            m_radius = 0.0f;
            m_color = Color.Gray;
            m_center = new Point3d();
            m_minmax = new MinMax(); // really should be bounding box
            m_hidden = false;
            tag = TAG_REGULAR;
        }
Exemplo n.º 2
0
 public Polygon()
 {
     m_normal = new Vector3d();
     m_radius = 0.0;
     m_color = Color.Gray;
     m_linecolor = Color.Blue;
     m_solid = true;
     m_wire = true;
     m_center = new Point3d();
     m_minmax = null;
     plane = new Plane();
 }
Exemplo n.º 3
0
        public void CalcMinMax()
        {
            m_minmax = new MinMax();
            m_minmax.m_min = m_points[0].z;
            m_minmax.m_max = m_points[0].z;

            foreach (Point3d pnt in m_points)
            {
                if (pnt.z > m_minmax.m_max)
                    m_minmax.m_max = pnt.z;

                if (pnt.z < m_minmax.m_min)
                    m_minmax.m_min = pnt.z;

            }
            //return mm;
        }
Exemplo n.º 4
0
        public MinMax CalcMinMax()
        {
            MinMax mm = new MinMax();
            mm.m_min = m_points[0].z;
            mm.m_max = m_points[0].z;

            foreach (Point3d pnt in m_points)
            {
                if (pnt.z > mm.m_max)
                    mm.m_max = pnt.z;

                if (pnt.z < mm.m_min)
                    mm.m_min = pnt.z;

            }
            return mm;
        }
Exemplo n.º 5
0
        /// <summary>
        /// This function calculates the Z scene extents.
        /// It will always incude z=0 to the max object z extent
        /// </summary>
        /// <returns></returns>
        public MinMax CalcSceneExtents()
        {
            MinMax mm = new MinMax();
            mm.m_min = 0.0f;
            try
            {
                int c = 0;
                foreach (Object3d obj in m_objects)
                {
                    //obj.CalcMinMaxes();
                    obj.FindMinMax();
                    if (c == 0) //first one
                    {
                        mm.m_min = obj.m_min.z;
                        mm.m_max = obj.m_max.z;
                    }
                    if (obj.m_min.z < mm.m_min)
                        mm.m_min = obj.m_min.z;

                    if (obj.m_max.z > mm.m_max)
                        mm.m_max = obj.m_max.z;
                    c++;
                }
            }
            catch (Exception ex)
            {
                DebugLogger.Instance().LogError(ex.Message);
            }
            return mm;
        }
Exemplo n.º 6
0
 /*
 /// <summary>
 /// For our purposes, I think this is only going to work well if
 /// there is no z varience - aka - all points are the same z on the ground plane
 /// </summary>
 /// <param name="scale"></param>
 /// <param name="startidx"></param>
 /// <param name="endidx"></param>
 private void ScaleRange(float scale, int startidx, int endidx)
 {
     //Point3d center = new Point3d();
     //calculate the center
     for (int c = startidx; c < endidx; c++)
     {
         m_lstpoints[c].x *= scale;
         m_lstpoints[c].y *= scale;
        // m_lstpoints[c].z *= scale;
     }
 }
 */
 private MinMax CalcMinMaxRange(int startidx, int endidx)
 {
     MinMax mm = new MinMax();
     mm.m_min = m_lstpoints[startidx].z;
     mm.m_max = m_lstpoints[startidx].z;
     for (int c = startidx; c < endidx; c++)
     {
         if (m_lstpoints[c].z < mm.m_min)
             mm.m_min = m_lstpoints[c].z;
         if (m_lstpoints[c].z > mm.m_max)
             mm.m_max = m_lstpoints[c].z;
     }
     return mm;
 }