Beispiel #1
0
 private void createShapes()
 {
     // disable eventing, otherwise, for each line added the whole panel would get reconfigured
     // which would lead to a poor startup performance
     EventingSuspend();
     // the ground is a lit surface
     if (m_surface == null)
     {
         List <ILArray <double> > mesh = Computation.CreateMesh(-m_max, m_max, m_lowCut, 0, m_res);
         m_surface         = new ILLitSurface(m_panel, mesh[0], mesh[1], mesh[2], new ILColormap(Colormaps.Jet));
         m_surface.Opacity = 190;
         Add(m_surface);
     }
     if (m_lines == null)
     {
         // we create all individual lines and save them (redundantly) for later convenient reference.
         // (the grid is made out of individual line shapes)
         List <ILArray <double> > lines = Computation.CreateLines(-m_max, m_max,
                                                                  m_lowCut, 0, m_res, m_gridSpacing, m_linesPositionOffset);
         m_lines = new List <ILLine>();
         for (int i = 0; i < lines[0].Dimensions[1]; i++)
         {
             // x - grid
             ILLine line = new ILLine(m_panel, lines[0][null, i], lines[1][null, i], lines[2][null, i]);
             line.Properties.Color = m_gridProperties.Color;
             line.Label.Text       = "";
             line.Properties.Width = m_gridProperties.Width;
             line.CustomCenter     = new ILPoint3Df(0, 0, -200);
             m_lines.Add(line);
             Add(line);
             // y - grid
             line = new ILLine(m_panel, lines[1][null, i], lines[0][null, i], lines[2][null, i]);
             line.Properties.Color = m_gridProperties.Color;
             line.Label.Text       = "";
             line.Properties.Width = m_gridProperties.Width;
             line.CustomCenter     = new ILPoint3Df(0, 0, -200);
             m_lines.Add(line);
             Add(line);
         }
     }
     // re-enable eventing, still one shape to be added: the sphere, which will cause a reconfiguration
     // of the whole panel
     EventingResume();
     // lit sphere
     if (m_sphere == null)
     {
         m_sphere = new ILLitSphere(m_panel, new ILPoint3Df(0, 0, 1.4f), 1.8f, Color.FromArgb(190, Color.Gold));
         Add(m_sphere);
         m_sphere.Label.Text = "";
         m_sphere.Opacity    = 190;
     }
 }
Beispiel #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;
            }
        }
Beispiel #3
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; 
                
            }

        }
Beispiel #4
0
 private void createShapes() {
     // disable eventing, otherwise, for each line added the whole panel would get reconfigured 
     // which would lead to a poor startup performance
     EventingSuspend(); 
     // the ground is a lit surface 
     if (m_surface == null) {
         List<ILArray<double>> mesh = Computation.CreateMesh(-m_max, m_max, m_lowCut, 0, m_res);
         m_surface = new ILLitSurface(m_panel, mesh[0], mesh[1], mesh[2], new ILColormap(Colormaps.Jet));
         m_surface.Opacity = 190;
         Add(m_surface); 
     }
     if (m_lines == null) {
         // we create all individual lines and save them (redundantly) for later convenient reference.
         // (the grid is made out of individual line shapes)
         List<ILArray<double>> lines = Computation.CreateLines(-m_max, m_max,
                                 m_lowCut, 0, m_res, m_gridSpacing, m_linesPositionOffset);
         m_lines = new List<ILLine>();
         for (int i = 0; i < lines[0].Dimensions[1]; i++) {
             // x - grid
             ILLine line = new ILLine(m_panel, lines[0][null, i], lines[1][null, i], lines[2][null, i]);
             line.Properties.Color = m_gridProperties.Color;
             line.Label.Text = "";
             line.Properties.Width = m_gridProperties.Width;
             line.CustomCenter = new ILPoint3Df(0,0,-200); 
             m_lines.Add(line);
             Add(line);
             // y - grid
             line = new ILLine(m_panel, lines[1][null, i], lines[0][null, i], lines[2][null, i]);
             line.Properties.Color = m_gridProperties.Color;
             line.Label.Text = "";
             line.Properties.Width = m_gridProperties.Width;
             line.CustomCenter = new ILPoint3Df(0,0,-200); 
             m_lines.Add(line);
             Add(line);
         }
     }
     // re-enable eventing, still one shape to be added: the sphere, which will cause a reconfiguration 
     // of the whole panel
     EventingResume(); 
     // lit sphere
     if (m_sphere == null) {
         m_sphere = new ILLitSphere(m_panel, new ILPoint3Df(0,0,1.4f), 1.8f, Color.FromArgb(190,Color.Gold)); 
         Add(m_sphere); 
         m_sphere.Label.Text = ""; 
         m_sphere.Opacity = 190; 
     } 
 }