// 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(); }