コード例 #1
0
        protected override void  ComputeLimits()
        {
            // only consider used(!) vertices (having indices in mapping)
            ILPoint3Df cent = new ILPoint3Df();

            if (m_shapeIndices.IsEmpty)
            {
                // fast exit
                m_positionCenter = cent;
                m_positionMin    = cent;
                m_positionMax    = cent;
                return;
            }
            ILPoint3Df max = ILPoint3Df.MinValue, min = ILPoint3Df.MaxValue, cur;

            foreach (int vertexID in m_shapeIndices.Values)
            {
                cur  = m_vertices[vertexID].Position;
                cent = cent + cur;
                max  = ILPoint3Df.Max(max, cur);
                min  = ILPoint3Df.Min(min, cur);
            }
            m_positionCenter = cent / m_vertices.Length;
            m_positionMax    = max;
            m_positionMin    = min;
            updateVertexPositions(Vertices, ref m_vertexPositions);
        }
コード例 #2
0
        protected override void ComputeLimits()
        {
            ILPoint3Df cent = new ILPoint3Df();

            if (m_vertices.Length == 0)
            {
                // fast exit
                m_positionCenter = cent;
                m_positionMin    = cent;
                m_positionMax    = cent;
                return;
            }
            ILPoint3Df max = ILPoint3Df.MinValue, min = ILPoint3Df.MaxValue, cur;

            foreach (IILVertexDefinition vertex in m_vertices)
            {
                cur  = vertex.Position;
                cent = cent + cur;
                max  = ILPoint3Df.Max(max, cur);
                min  = ILPoint3Df.Min(min, cur);
            }
            m_positionCenter = cent / m_vertices.Length;
            m_positionMax    = max;
            m_positionMin    = min;
        }
コード例 #3
0
        ///// <summary>
        ///// signaled when one/some of the ILGraphs have changed
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //void Graph_Changed(object sender, ILGraphChangedEventArgs e) {
        //    OnGraphChanged(sender as ILGraph,e);
        //}
        /// <summary>
        /// called once the limits of a graph have changed
        /// </summary>
        /// <param name="sender">graph</param>
        /// <param name="e">event args, holding a reference to the clipping data</param>
        void Limits_Changed(object sender, ClippingChangedEventArgs e)
        {
            ILPoint3Df max = ILPoint3Df.MinValue;
            ILPoint3Df min = ILPoint3Df.MaxValue;

            foreach (ILGraph graph in this)
            {
                max = ILPoint3Df.Max(max, graph.Limits.Max);
                min = ILPoint3Df.Min(min, graph.Limits.Min);
            }
            m_clippingData.Set(min, max);
        }
コード例 #4
0
        private void updateClipping()
        {
            ILPoint3Df max = ILPoint3Df.MinValue;
            ILPoint3Df min = ILPoint3Df.MaxValue;

            for (int i = 0; i < m_vertexCount; i++)
            {
                C4bV3f vert = m_vertices[i];
                max = ILPoint3Df.Max(vert.Position, max);
                min = ILPoint3Df.Min(vert.Position, min);
            }
            m_localClipping.Set(min, max);
        }
コード例 #5
0
 public ILZoomAction(ILPoint3Df MinCornerStart,
                     ILPoint3Df MinCornerEnd,
                     ILPoint3Df MaxCornerStart,
                     ILPoint3Df MaxCornerEnd,
                     ILActionRamp ramp,
                     ILPanel panel)
     : base()
 {
     m_MaxCornerEnd   = ILPoint3Df.Max(MinCornerEnd, MaxCornerEnd);
     m_MaxCornerStart = ILPoint3Df.Max(MinCornerStart, MaxCornerStart);
     m_MinCornerEnd   = ILPoint3Df.Min(MinCornerEnd, MaxCornerEnd);
     m_MinCornerStart = ILPoint3Df.Min(MinCornerStart, MaxCornerStart);
     m_ramp           = ramp;
     m_panel          = panel;
 }
コード例 #6
0
 public void Queue(IILVertexDefinition vertex)
 {
     SetVertex(m_oldestVertexID++, vertex);
     if (m_oldestVertexID >= m_vertCount)
     {
         m_oldestVertexID = 0;
     }
     if (m_updateCount++ < m_autoLimitsUpdateCount)
     {
         bool signal = false;
         m_positionMax = ILPoint3Df.Max(m_positionMax, vertex.Position, ref signal);
         m_positionMin = ILPoint3Df.Min(m_positionMin, vertex.Position, ref signal);
         if (signal)
         {
             OnSizeChanged();
         }
     }
     else
     {
         m_updateCount = 0;
         Invalidate();
     }
 }
コード例 #7
0
        /// <summary>
        /// compute limits of the cube tightly enclosing the branch below this node
        /// </summary>
        /// <returns></returns>
        protected override void ComputeNodeLimits()
        {
            if (m_childs == null || m_childs.Count == 0)
            {
                m_positionMin = ILPoint3Df.Empty;
                m_positionMax = ILPoint3Df.Empty;
                return;
            }
            // acquire maximum position
            ILPoint3Df curMax = ILPoint3Df.MinValue;
            ILPoint3Df curMin = ILPoint3Df.MaxValue;

            foreach (ILSceneGraphNode node in m_childs)
            {
                curMin = ILPoint3Df.Min(node.PositionMin, curMin);
            }
            curMax = ILPoint3Df.MinValue;
            foreach (ILSceneGraphNode node in m_childs)
            {
                curMax = ILPoint3Df.Max(node.PositionMax, curMax);
            }
            m_positionMax = curMax;
            m_positionMin = curMin;
            m_center      = (m_positionMax + m_positionMin) / 2;
            // stores childs centers for sorting
            if (m_centers == null)
            {
                m_centers = new ILArray <float>();
            }
            for (int i = m_childs.Count; i-- > 0;)
            {
                ILPoint3Df center = m_childs[i].Center;
                m_centers.SetValue(center.X, i, 0);
                m_centers.SetValue(center.Y, i, 1);
                m_centers.SetValue(center.Z, i, 2);
            }
        }
コード例 #8
0
ファイル: ILLitBox3D.cs プロジェクト: zhufengGNSS/ILNumerics
        /// <summary>
        /// create new lit 3D box
        /// </summary>
        /// <param name="panel">panel hosting the scene</param>
        /// <param name="min">minimum coordinates defining the box' dimensions (x,y,z)</param>
        /// <param name="max">minimum coordinates defining the box' dimensions (x,y,z)</param>
        /// <param name="fillColor">overall color for the box</param>
        /// <param name="topColor">color used to color the top edges of the box</param>
        public ILLitBox3D(ILPanel panel, ILPoint3Df min, ILPoint3Df max, Color fillColor, Color topColor)
            : base(panel)
        {
            m_lineProperties          = new ILLineProperties();
            m_lineProperties.Changed += new EventHandler(m_lineProperties_Changed);
            m_valLabel      = new ILWorldLabel(panel);
            m_valLabel.Text = "";  // (max * 1000).Z.ToString("F3");

            ILPoint3Df mi = ILPoint3Df.Min(min, max);
            ILPoint3Df ma = ILPoint3Df.Max(min, max);

            m_valLabel.PositionMax = new ILPoint3Df(ma.X, mi.Y, ma.Z);
            m_valLabel.PositionMin = new ILPoint3Df(mi.X, ma.Y, ma.Z);;

            m_topLabel       = new ILShapeLabel(panel);
            m_topLabel.Color = Color.Blue;
            //m_topLabel.Font = new Font("Arial", 10, FontStyle.Bold);
            string tval = max.Z.ToString("F2");

            m_topLabel.Text   = String.Format("{0}", tval);
            m_topLabel.Anchor = new PointF(0.5f, 1);

            m_topColor = topColor;

            #region setup quads
            m_quads = new ILLitQuad[6];

            // front
            ILLitQuad quad = new ILLitQuad(m_panel);
            quad.Vertices[0].Position  = new ILPoint3Df(min.X, min.Y, min.Z);
            quad.Vertices[1].Position  = new ILPoint3Df(min.X, min.Y, max.Z);
            quad.Vertices[2].Position  = new ILPoint3Df(max.X, min.Y, max.Z);
            quad.Vertices[3].Position  = new ILPoint3Df(max.X, min.Y, min.Z);
            m_quads[QuadIndices.front] = quad;
            // right
            quad = new ILLitQuad(m_panel);
            quad.Vertices[0].Position  = new ILPoint3Df(max.X, min.Y, min.Z);
            quad.Vertices[1].Position  = new ILPoint3Df(max.X, min.Y, max.Z);
            quad.Vertices[2].Position  = new ILPoint3Df(max.X, max.Y, max.Z);
            quad.Vertices[3].Position  = new ILPoint3Df(max.X, max.Y, min.Z);
            m_quads[QuadIndices.right] = quad;
            // back
            quad = new ILLitQuad(m_panel);
            quad.Vertices[0].Position = new ILPoint3Df(max.X, max.Y, min.Z);
            quad.Vertices[1].Position = new ILPoint3Df(max.X, max.Y, max.Z);
            quad.Vertices[2].Position = new ILPoint3Df(min.X, max.Y, max.Z);
            quad.Vertices[3].Position = new ILPoint3Df(min.X, max.Y, min.Z);
            m_quads[QuadIndices.back] = quad;
            // left
            quad = new ILLitQuad(m_panel);
            quad.Vertices[0].Position = new ILPoint3Df(min.X, max.Y, min.Z);
            quad.Vertices[1].Position = new ILPoint3Df(min.X, max.Y, max.Z);
            quad.Vertices[2].Position = new ILPoint3Df(min.X, min.Y, max.Z);
            quad.Vertices[3].Position = new ILPoint3Df(min.X, min.Y, min.Z);
            m_quads[QuadIndices.left] = quad;
            // top
            quad = new ILLitQuad(m_panel);
            quad.Vertices[0].Position = new ILPoint3Df(min.X, min.Y, max.Z);
            quad.Vertices[1].Position = new ILPoint3Df(max.X, min.Y, max.Z);
            quad.Vertices[2].Position = new ILPoint3Df(max.X, max.Y, max.Z);
            quad.Vertices[3].Position = new ILPoint3Df(min.X, max.Y, max.Z);
            m_quads[QuadIndices.top]  = quad;
            // bottom
            quad = new ILLitQuad(m_panel);
            quad.Vertices[0].Position   = new ILPoint3Df(min.X, min.Y, min.Z);
            quad.Vertices[1].Position   = new ILPoint3Df(max.X, min.Y, min.Z);
            quad.Vertices[2].Position   = new ILPoint3Df(max.X, max.Y, min.Z);
            quad.Vertices[3].Position   = new ILPoint3Df(min.X, max.Y, min.Z);
            m_quads[QuadIndices.bottom] = quad;
            #endregion
            EventingSuspend();
            foreach (ILLitQuad s in m_quads)
            {
                s.Label.Text          = "";
                s.Shading             = ShadingStyles.Interpolate;
                s.Opacity             = m_opacity;
                s.Border.Color        = Color.Gray;
                s.Border.Width        = 1;
                s.Border.Visible      = true;
                s.Border.Antialiasing = false;
                Add(s);
            }
            EventingResume();
            m_fillColor = fillColor;
            updateColors();
        }