Exemple #1
0
        /// <summary>
        /// create new lit surface, provide data for X,Y and Z coordinates
        /// </summary>
        /// <param name="panel">the panel hosting the scene</param>
        /// <param name="X">X coordinates matrix, same size as Z or null</param>
        /// <param name="Y">Y coordinates matrix, same size as Z or null</param>
        /// <param name="Z">Z data matrix, at least 2 rows, 2 columns</param>
        /// <param name="colormap">colormap used for auto coloring the surface</param>
        public ILLitSurface(ILPanel panel, ILBaseArray X, ILBaseArray Y, ILBaseArray Z, ILColormap colormap)
            : base(panel)
        {
            if (Z == null || Z.Dimensions[0] < 2 || Z.Dimensions[1] < 2)
            {
                throw new ArgumentException("invalid parameter size: Z");
            }
            if (X == null || !X.Dimensions.IsSameSize(Z.Dimensions))
            {
                throw new ArgumentException("invalid parameter size: X");
            }
            if (Y == null || !Y.Dimensions.IsSameSize(Z.Dimensions))
            {
                throw new ArgumentException("invalid parameter size: Y");
            }
            m_quads            = new ILLitQuads(panel, Z.Dimensions.NumberOfElements);
            m_quads.Label.Text = "";
            m_quads.Shading    = ShadingStyles.Interpolate;
            Add(m_quads);
            m_colorMap = colormap;
            ZValues    = Z;
            XValues    = X;
            YValues    = Y;

            Invalidate();
        }
Exemple #2
0
        /// <summary>
        /// create new lit surface, provide data for X,Y and Z coordinates
        /// </summary>
        /// <param name="panel">the panel hosting the scene</param>
        /// <param name="X">X coordinates matrix, same size as Z or null</param>
        /// <param name="Y">Y coordinates matrix, same size as Z or null</param>
        /// <param name="Z">Z data matrix, at least 2 rows, 2 columns</param>
        /// <param name="colormap">colormap used for auto coloring the surface</param>
        public ILLitSurface(ILPanel panel, ILBaseArray X, ILBaseArray Y, ILBaseArray Z, ILColormap colormap)
            : base(panel) {
            if (Z == null || Z.Dimensions[0] < 2 || Z.Dimensions[1] < 2)
                throw new ArgumentException("invalid parameter size: Z");
            if (X == null || !X.Dimensions.IsSameSize(Z.Dimensions))
                throw new ArgumentException("invalid parameter size: X");
            if (Y == null || !Y.Dimensions.IsSameSize(Z.Dimensions))
                throw new ArgumentException("invalid parameter size: Y");
            m_quads = new ILLitQuads(panel, Z.Dimensions.NumberOfElements);
            m_quads.Label.Text = ""; 
            m_quads.Shading = ShadingStyles.Interpolate;
            Add(m_quads);
            m_colorMap = colormap;
            ZValues = Z; 
            XValues = X;
            YValues = Y;

            Invalidate();
        }
Exemple #3
0
        // in Form_Load the panel and all shapes should be created
        // and initialized.
        private void Form1_Load(object sender, EventArgs e)
        {
            // the ILPanel is created ...
            m_panel = ILPanel.Create();
            // and added to the Controls collection of the form
            Controls.Add(m_panel);
            // a scene graph will hold our shapes
            ILSceneGraph scene = m_panel.Graphs.AddSceneGraph();

            // data for the shapes are best created in the Computation
            // helper - keeping the GUI code clean
            ILCell data = Computation.CreatePendulaWeight();

            // setup the first polygon. For creation we do
            // not specify vertex data yet. This will be done
            // later in the UpdateShapes function
            m_poly1 = new ILLitPolygon(m_panel, data[0].Dimensions[1]);
            m_poly1.Border.Width = 2;
            m_poly1.Border.Color = Color.Gray;
            m_poly1.Opacity      = 180;
            m_poly1.CustomCenter = new ILPoint3Df(0, 0, 1);
            m_poly1.Label.Text   = "";
            // and add it to the scene. We create an individual node
            // for the weight' shapes.
            ILSceneGraphInnerNode weightNode = new ILSceneGraphInnerNode(m_panel);

            scene.AddNode(weightNode);
            weightNode.Add(m_poly1);

            // setup the 2nd polygon. The same size is here used as
            // for the first polygon.
            m_poly2 = new ILLitPolygon(m_panel, data[0].Dimensions[1]);
            m_poly2.Border.Width = 2;
            m_poly2.Border.Color = Color.Gray;
            m_poly2.Opacity      = 180;
            m_poly2.Label.Text   = "";
            m_poly2.CustomCenter = new ILPoint3Df(0, 0, 1);
            weightNode.Add(m_poly2);

            // the same for the quads: only give the number
            // of vertices needed. Data are updated later
            m_quads              = new ILLitQuads(m_panel, data[0].Dimensions[1] * 2);
            m_quads.FillColor    = Color.Red;
            m_quads.Opacity      = 180;
            m_quads.Label.Text   = "";
            m_quads.CustomCenter = new ILPoint3Df(0, 0, 1);
            // add the quads to the scene
            weightNode.Add(m_quads);

            // create the scale below the pendula weight
            ILCell           lData = Computation.CreateScale();
            ILArray <double> vert  = lData[0] as ILArray <double>;
            ILArray <double> maps  = lData[1] as ILArray <double>;

            m_lines                  = new ILLines(m_panel, vert[0.0, null], vert[1.0, null], vert[2.0, null], maps);
            m_lines.Label.Text       = "";
            m_lines.Properties.Color = Color.Black;
            m_lines.Shading          = ShadingStyles.Flat;
            // the scale lines we put directly in the root node
            // (no need to create an extra inner node for them)
            scene.AddNode(m_lines);

            // initialize the shapes
            UpdateShapes(data);

            // Experiment with these panel settings! They get clear than!
            //m_panel.PlotBoxScreenSizeMode = PlotBoxScreenSizeMode.StrictOptimal; // default: Optimal
            //m_panel.AutoZoomContent = false; // (default: true)
            m_panel.AspectRatio = AspectRatioMode.MaintainRatios;
            //m_panel.Projection = Projection.Perspective;
            m_panel.InteractiveMode = InteractiveModes.Rotating;

            // setup the timer control
            m_timer          = new Timer();
            m_timer.Interval = 40;
            m_timer.Tick    += new EventHandler(m_timer_Tick);
            m_timer.Start();
        }
Exemple #4
0
        // in Form_Load the panel and all shapes should be created 
        // and initialized. 
        private void Form1_Load(object sender, EventArgs e) {
            // the ILPanel is created ... 
            m_panel = ILPanel.Create(); 
            // and added to the Controls collection of the form
            Controls.Add(m_panel); 
            // a scene graph will hold our shapes 
            ILSceneGraph scene = m_panel.Graphs.AddSceneGraph();
            
            // data for the shapes are best created in the Computation
            // helper - keeping the GUI code clean
            ILCell data = Computation.CreatePendulaWeight();
            // setup the first polygon. For creation we do 
            // not specify vertex data yet. This will be done 
            // later in the UpdateShapes function
            m_poly1 = new ILLitPolygon(m_panel, data[0].Dimensions[1]);
            m_poly1.Border.Width = 2; 
            m_poly1.Border.Color = Color.Gray; 
            m_poly1.Opacity = 180; 
            m_poly1.CustomCenter = new ILPoint3Df(0,0,1); 
            m_poly1.Label.Text = ""; 
            // and add it to the scene. We create an individual node 
            // for the weight' shapes.
            ILSceneGraphInnerNode weightNode = new ILSceneGraphInnerNode(m_panel); 
            scene.AddNode(weightNode); 
            weightNode.Add(m_poly1);

            // setup the 2nd polygon. The same size is here used as 
            // for the first polygon. 
            m_poly2 = new ILLitPolygon(m_panel, data[0].Dimensions[1]);
            m_poly2.Border.Width = 2; 
            m_poly2.Border.Color = Color.Gray; 
            m_poly2.Opacity = 180; 
            m_poly2.Label.Text = ""; 
            m_poly2.CustomCenter = new ILPoint3Df(0,0,1); 
            weightNode.Add(m_poly2); 

            // the same for the quads: only give the number 
            // of vertices needed. Data are updated later
            m_quads = new ILLitQuads(m_panel, data[0].Dimensions[1] * 2); 
            m_quads.FillColor = Color.Red;
            m_quads.Opacity = 180; 
            m_quads.Label.Text = ""; 
            m_quads.CustomCenter = new ILPoint3Df(0,0,1); 
            // add the quads to the scene
            weightNode.Add(m_quads); 

            // create the scale below the pendula weight
            ILCell lData = Computation.CreateScale(); 
            ILArray<double> vert = lData[0] as ILArray<double>; 
            ILArray<double> maps = lData[1] as ILArray<double>; 
            m_lines = new ILLines(m_panel, vert[0.0,null], vert[1.0,null], vert[2.0,null], maps);
            m_lines.Label.Text = ""; 
            m_lines.Properties.Color = Color.Black; 
            m_lines.Shading = ShadingStyles.Flat; 
            // the scale lines we put directly in the root node 
            // (no need to create an extra inner node for them)  
            scene.AddNode(m_lines); 
            
            // initialize the shapes
            UpdateShapes(data);
            
            // Experiment with these panel settings! They get clear than! 
            //m_panel.PlotBoxScreenSizeMode = PlotBoxScreenSizeMode.StrictOptimal; // default: Optimal 
            //m_panel.AutoZoomContent = false; // (default: true)  
            m_panel.AspectRatio = AspectRatioMode.MaintainRatios;
            //m_panel.Projection = Projection.Perspective; 
            m_panel.InteractiveMode = InteractiveModes.Rotating; 
            
            // setup the timer control
            m_timer = new Timer(); 
            m_timer.Interval = 40;
            m_timer.Tick += new EventHandler(m_timer_Tick);
            m_timer.Start(); 

        }