/// <summary>
        /// add a plot to a new scene graph
        /// </summary>
        /// <param name="plot">plot to be added to the panel</param>
        /// <returns>newly created scene graph</returns>
        public ILSceneGraph AddPlot(ILPlot plot)
        {
            ILSceneGraph scene = AddSceneGraph();

            scene.AddNode(plot);
            return(scene);
        }
示例#2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Color Specular = Color.FromArgb(255, 255, 255);
            Color Ambient  = Color.FromArgb(90, 90, 90);
            Color Diffuse  = Color.FromArgb(160, 160, 160);

            label1.Text = String.Format(@"
Sphere:
===========
Specular: White
Color: White
Shininess: 96");
            label2.Text = String.Format(@"
Panel.Lights[0]:   
============
Ambient: {0}       
Diffuse: {1}              
Specular: {2}", Ambient, "s.b.", Specular);

            this.Size = new Size(450, 300);
            //byte[] values = new byte[] {5,20,100};
            Color[] colors = new Color[3] {
                Color.LightGray, Color.Black, Color.Blue
            };
            for (int i = 0; i < 3; i++)
            {
                ILPanel panel = ILPanel.Create();
                tableLayoutPanel1.Controls.Add(panel, i, 1);
                panel.Dock = DockStyle.Fill;
                //panel.Lights[0].Diffuse = colors[i];
                ILSceneGraph scene  = panel.Graphs.AddSceneGraph();
                ILLitSphere  sphere = new ILLitSphere(panel, new ILPoint3Df(), 1f, Color.Green, 3);
                sphere.Label.Text   = "";
                sphere.Label.Anchor = new PointF(1, 0);
//                sphere.Material.Specular = Color.White;
//                sphere.Material.Shininess = 96;
                sphere.Label.Text        = String.Format(@"\itLight.Diffuse:
{0}", colors[i]);
                sphere.Label.Orientation = TextOrientation.Vertical;
                scene.AddNode(sphere);
                //panel.Axes.XAxis.Label.
                panel.BackgroundFilled      = false;
                panel.AspectRatio           = AspectRatioMode.MaintainRatios;
                panel.PlotBoxScreenSizeMode = PlotBoxScreenSizeMode.StrictOptimal;
            }
        }
示例#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();
        }