Ejemplo n.º 1
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent(OGL ogl)
 {
     this.ogl1 = ogl;
     this.SuspendLayout();
     //
     // ogl1
     //
     this.ogl1.Location = new System.Drawing.Point(41, 35);
     this.ogl1.Name     = "ogl1";
     this.ogl1.Size     = new System.Drawing.Size(136, 139);
     this.ogl1.TabIndex = 0;
     this.ogl1.Text     = "ogl1";
     this.ogl1.Click   += new System.EventHandler(this.ogl1_Click);
     //
     // FormMaxSize
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(282, 255);
     this.Controls.Add(this.ogl1);
     this.Name  = "FormMaxSize";
     this.Text  = "FormMaxSize";
     this.Load += new System.EventHandler(this.FormMaxSize_Load);
     this.ResumeLayout(false);
 }
        public override void Draw(Point cursorCoordinates)
        {
            if (count == 0)
            {
                OGL.DrawFilledCircle(new Pen(Color.Yellow), cursorCoordinates, 5);
            }
            if (count == 1)
            {
                OGL.DrawFilledCircle(new Pen(Color.Yellow), cursorCoordinates, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p1, 5);
            }
            if (count == 2 && (SystemCoordinates)cursorCoordinates != p1 && (SystemCoordinates)cursorCoordinates != p2)
            {
                if (SystemCoordinates.InOneLine(p1, cursorCoordinates, p2))
                {
                    OGL.DrawFilledCircle(new Pen(Color.Yellow), p1, 5);
                    OGL.DrawFilledCircle(new Pen(Color.Yellow), p2, 5);
                    Line a = new Line(p1, p2, false);
                    a.Drawer(Color.Black, 2);
                }
                else
                {
                    OGL.DrawFilledCircle(new Pen(Color.Yellow), p1, 5);
                    OGL.DrawFilledCircle(new Pen(Color.Yellow), p2, 5);
                    Circle a = new Circle(p1, cursorCoordinates, p2);
                    a.Draw();
                }
                OGL.DrawFilledCircle(new Pen(Color.Yellow), cursorCoordinates, 5);
            }
            if (count == 3 && (SystemCoordinates)cursorCoordinates != p1 && (SystemCoordinates)cursorCoordinates != p2 && (SystemCoordinates)cursorCoordinates != p3)
            {
                if (SystemCoordinates.InOneLine(p1, cursorCoordinates, p2))
                {
                    OGL.DrawFilledCircle(new Pen(Color.Yellow), p1, 5);
                    OGL.DrawFilledCircle(new Pen(Color.Yellow), p2, 5);
                    Line a = new Line(p1, p2, false);
                    a.Drawer(Color.Black, 2);
                }
                else
                {
                    OGL.DrawFilledCircle(new Pen(Color.Yellow), p1, 5);
                    OGL.DrawFilledCircle(new Pen(Color.Yellow), p2, 5);
                    Circle a = new Circle(p1, cursorCoordinates, p2);
                    a.Draw();
                }

                if (!SystemCoordinates.InOneLine(p1, p3, p2))
                {
                    Circle b = new Circle(p1, p3, p2);
                    b.Draw();
                }
                else
                {
                    Line b = new Line(p1, p2, false);
                    b.Drawer(Color.Black, 2);
                }
                OGL.DrawFilledCircle(new Pen(Color.Yellow), cursorCoordinates, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p3, 5);
            }
        }
Ejemplo n.º 3
0
 private unsafe void ApplyVBOBufferData()
 {
     OGL.BindBuffer(GLEnum.ArrayBuffer, (uint)VBO);
     fixed(void *arr = Buffer)
     {
         OGL.BufferData(GLEnum.ArrayBuffer, (UIntPtr)(sizeof(float) * Buffer.Length), arr, IsStatic ?
                        GLEnum.StaticDraw : GLEnum.DynamicDraw);
     }
 }
Ejemplo n.º 4
0
 private unsafe void ApplyIBOBufferData()
 {
     OGL.BindBuffer(GLEnum.ElementArrayBuffer, (uint)IBO);
     fixed(void *arr = Indices)
     {
         OGL.BufferData(GLEnum.ElementArrayBuffer, (UIntPtr)(sizeof(uint) * Indices.Length), arr, IsStatic ?
                        GLEnum.StaticDraw : GLEnum.DynamicDraw);
     }
 }
Ejemplo n.º 5
0
 public override void Draw(System.Drawing.Point cursorCoordinates)
 {
     if (counter == 0)
     {
         OGL.DrawFilledCircle(new Pen(Color.Black, 6), new Point(cursorCoordinates.X, cursorCoordinates.Y), 6);
     }
     else
     {
         OGL.DrawFilledCircle(new Pen(Color.Blue, 6), new Point(p1.X, p1.Y), 6);
     }
 }
Ejemplo n.º 6
0
 public void Bind()
 {
     if (VAO < 0)
     {
         UpdateBuffers();
     }
     OGL.BindVertexArray((uint)VAO);
     OGL.BindBuffer(GLEnum.ArrayBuffer, (uint)VBO);
     ApplyAttributes();
     OGL.BindBuffer(GLEnum.ElementArrayBuffer, (uint)IBO);
 }
Ejemplo n.º 7
0
        private unsafe void ApplyAttributes()
        {
            int stride = sizeof(float) * (3 + 2 + 3);

            OGL.EnableVertexAttribArray(0);
            OGL.VertexAttribPointer(0, 3, GLEnum.Float, false, (uint)stride, (void *)0);
            OGL.EnableVertexAttribArray(1);
            OGL.VertexAttribPointer(1, 2, GLEnum.Float, false, (uint)stride, (void *)(sizeof(float) * 3));
            OGL.EnableVertexAttribArray(2);
            OGL.VertexAttribPointer(2, 3, GLEnum.Float, false, (uint)stride, (void *)(sizeof(float) * (3 + 2)));
        }
Ejemplo n.º 8
0
        public override void Draw(Point cursorCoordinates)
        {
            SystemCoordinates pp1  = CoordinateSystem.Instance.Converter(p1);
            SystemCoordinates curs = CoordinateSystem.Instance.Converter(cursorCoordinates);

            if (counter == 0)
            {
                OGL.DrawFilledCircle(new Pen(Color.Yellow), cursorCoordinates, 10);
            }
            if (counter == 1)
            {
                if (control_modifier == false)
                {
                    if (alt_modifier == true)
                    {
                        pp1 = pp1.BuildPointReflection(curs);
                    }
                    Line x = new Line(pp1,
                                      curs, false);
                    x.BuildAngle();
                    if (cursorCoordinates != p1)
                    {
                        MirrorDrawer.Draw(x.AngleForOnePointLines, pp1, curs);
                        OGL.DrawFilledCircle(new Pen(Color.Yellow), p1, 10);
                    }
                }
                else
                {
                    if (alt_modifier == true)
                    {
                        pp1 = pp1.BuildPointReflection(curs);
                    }
                    Line x = new Line(curs,
                                      pp1, false);
                    x.BuildAngle();
                    if (cursorCoordinates != p1)
                    {
                        MirrorDrawer.Draw(x.AngleForOnePointLines, curs, pp1);
                        OGL.DrawFilledCircle(new Pen(Color.Yellow), p1, 10);
                    }
                }
            }
            if (counter == 2)
            {
                MirrorDrawer.Draw(x.AngleForOnePointLines, x);
            }
        }
Ejemplo n.º 9
0
 public void Draw(bool selected = false)
 {
     if (!(ULimitSet && LLimitSet))
     {
         Drawing.CircleDrawer.Draw(selected, center, radius * CoordinateSystem.Instance.Scale);
     }
     else
     {
         DoubleExtention l1 = lowerLimitAngle;
         DoubleExtention l2 = upperLimitAngle;
         if (l1 > l2)
         {
             l1 -= 2 * Math.PI;
         }
         Drawing.CircleDrawer.Draw(selected, center, radius * CoordinateSystem.Instance.Scale, l1, l2);
         OGL.DrawFilledCircle(new Pen(selected?Color.Blue:Color.Black), ULimitPoint, 1);
     }
 }
Ejemplo n.º 10
0
 public void CleanBuffers()
 {
     if (VAO >= 0)
     {
         OGL.DeleteVertexArray((uint)VAO);
     }
     if (VBO >= 0)
     {
         OGL.DeleteBuffer((uint)VBO);
     }
     if (IBO >= 0)
     {
         OGL.DeleteBuffer((uint)IBO);
     }
     VAO = -1;
     VBO = -1;
     IBO = -1;
 }
Ejemplo n.º 11
0
 public override void Draw(Point cursorCoordinates)
 {
     if (ring.Count == 0)
     {
         OGL.DrawFilledCircle(new Pen(Color.Yellow), cursorCoordinates, 5);
     }
     if (ring.Count == 1)
     {
         if ((SystemCoordinates)cursorCoordinates != ring[0])
         {
             Line drw = new Line(cursorCoordinates, ring[0], false);
             drw.Drawer(Color.Black, 2);
             OGL.DrawFilledCircle(new Pen(Color.Yellow), cursorCoordinates, 5);
         }
     }
     if (ring.Count > 1)
     {
         if (ring[0] != ring[ring.Count - 1])
         {
             for (int i = 0; i < ring.Count - 1; i++)
             {
                 Line draw = new Line(ring[i], ring[i + 1], false);
                 draw.Drawer(Color.Black, 2);
             }
             if ((ring[0].Distance(cursorCoordinates) * CoordinateSystem.Instance.Scale) < 5)
             {
                 cursorCoordinates = ring[0];
             }
             Line draww = new Line(ring[ring.Count - 1], cursorCoordinates, false);
             draww.Drawer(Color.Black, 2);
         }
         else
         {
             for (int i = 0; i < ring.Count - 1; i++)
             {
                 Line draw = new Line(ring[i], ring[i + 1], false);
                 draw.Drawer(Color.Black, 2);
             }
         }
         OGL.DrawFilledCircle(new Pen(Color.Yellow), cursorCoordinates, 5);
     }
 }
Ejemplo n.º 12
0
 public override void Draw(Point cursorCoordinates)
 {
     if (counter == 0)
     {
         BrightPoint tmp = null;
         var         a   = ObjectCollection.Instance.objects;
         foreach (var b in a)
         {
             if (b is BrightPoint)
             {
                 if (b.DistanceToPointS(cursorCoordinates) <= 6)
                 {
                     tmp = (BrightPoint)b;
                 }
             }
         }
         if (tmp == null)
         {
             OGL.DrawFilledCircle(new Pen(Color.Yellow, 6), cursorCoordinates, 6);
         }
         else
         {
             OGL.DrawFilledCircle(new Pen(Color.Yellow, 3), tmp.Coordinates, 3);
         }
     }
     if (counter == 1)
     {
         if (GenNew)
         {
             OGL.DrawFilledCircle(new Pen(Color.Black, 6), p1, 6);
         }
         LineDrawer.DrawLine(p1, cursorCoordinates, Color.DarkGreen, 1);
     }
     if (counter == 2)
     {
         if (GenNew)
         {
             OGL.DrawFilledCircle(new Pen(Color.Black, 6), p1, 6);
         }
         LineDrawer.DrawLine(p1, p2, Color.DarkGreen, 1);
     }
 }
Ejemplo n.º 13
0
        public override void Drawer()
        {
            DoubleExtention l1 = a.LowerLimitAngle.GetInRadians(), l2 = a.UpperLimitAngle.GetInRadians();

            if (l1 > l2)
            {
                l1 -= 2 * Math.PI;
            }
            if (vognutoye == false)
            {
                OGL.DrawCirclePart(new Pen(Color.Red, 4), a.Center, ((r * CoordinateSystem.Instance.Scale - 2) <= 0) ? 1 : (r * CoordinateSystem.Instance.Scale - 2), l1, l2);
            }
            else
            {
                OGL.DrawCirclePart(new Pen(Color.Red, 4), a.Center, r * CoordinateSystem.Instance.Scale + 2, l1, l2);
            }
            a.Draw(Selected);
            //OGL.DrawFilledCircle(new Pen(Color.Red, 4), coordinates, ((r * CoordinateSystem.Instance.Scale - 2) <= 0) ? 1 : (r * CoordinateSystem.Instance.Scale - 2));
            //a.Draw(Selected);
            //OGL.DrawCircle(new Pen((!Selected)?Color.Black:Color.Blue), coordinates, r*CoordinateSystem.Instance.Scale);
        }
Ejemplo n.º 14
0
        public override void Bind()
        {
            int TexIdx = 0;

            foreach (Property property in GetProperties())
            {
                if (property.Type == typeof(Texture))
                {
                    string path = property.Get <string>();
                    if (!File.Exists(path))
                    {
                        throw new Exception("Texture doesn't exist: " + property.Name + "@" + path);
                    }
                    if (!TextureCache.ContainsKey(path))
                    {
                        TextureCache.Add(path, property.Get <Texture>(true));
                    }
                    TextureUnit TexUnit = (Silk.NET.OpenGL.TextureUnit)Enum.GetValues(typeof(Silk.NET.OpenGL.TextureUnit)).GetValue
                                              (Enum.GetNames(typeof(Silk.NET.OpenGL.TextureUnit)).ToList().IndexOf("Texture" + TexIdx));
                    OGL.ActiveTexture(TexUnit);
                    TextureCache[path].Bind();
                    Properties.SetProperty1(property.Name, TexIdx);
                    TexIdx++;
                }
                else if (property.Type == typeof(float))
                {
                    Properties.SetProperty1(property.Name, property.Get <float>());
                }
                else if (property.Type == typeof(Vector2))
                {
                    Properties.SetProperty2(property.Name, property.Get <Vector2>());
                }
                else if (property.Type == typeof(Vector3))
                {
                    Properties.SetProperty3(property.Name, property.Get <Vector3>());
                }
            }
        }
Ejemplo n.º 15
0
 public override void Draw(Point cursorCoordinates)
 {
     if (count == 0)
     {
         OGL.DrawFilledCircle(new Pen(Color.Yellow, 4), cursorCoordinates, 2);
     }
     if (count == 1)
     {
         OGL.DrawFilledCircle(new Pen(Color.Yellow, 4), c1, 2);
         OGL.DrawFilledCircle(new Pen(Color.Yellow, 4), cursorCoordinates, 2);
     }
     if (count == 2)
     {
         OGL.DrawFilledCircle(new Pen(Color.Yellow, 4), c1, 2);
         OGL.DrawFilledCircle(new Pen(Color.Yellow, 4), c2, 2);
         if (!SystemCoordinates.InOneLine(c1, c2, cursorCoordinates))
         {
             Circle      a = new Circle(c1, cursorCoordinates, c2);
             ObjectProto x = new SphereMirror("A~~112e^", a.Center, a.Radius, c1, cursorCoordinates, c2, control_modifier);
             x.Drawer();
         }
         OGL.DrawFilledCircle(new Pen(Color.Yellow, 4), cursorCoordinates, 2);
     }
     if (count == 3)
     {
         OGL.DrawFilledCircle(new Pen(Color.Yellow, 4), c1, 2);
         OGL.DrawFilledCircle(new Pen(Color.Yellow, 4), c2, 2);
         OGL.DrawFilledCircle(new Pen(Color.Yellow, 4), c3, 2);
         if (!SystemCoordinates.InOneLine(c1, c2, c3))
         {
             Circle      a = new Circle(c1, c3, c2);
             ObjectProto x = new SphereMirror("A~~112e^", a.Center, a.Radius, c1, c3, c2, control_modifier);
             x.Drawer();
         }
     }
 }
Ejemplo n.º 16
0
        /// <summary>
        /// OpenGL rendering code itself (separated for clarity).
        /// </summary>
        private void RenderScene()
        {
            // Simulation scene rendering.
            MarblesRenderData rdata = null;

            if (renderer != null &&
                OGL.useShaders)
            {
                lock (renderer)
                    rdata = data;
            }

            if (rdata != null)
            {
                OGL.FormData();

                // Simulated scene.
                primitiveCounter += renderer.Render(OGL, rdata);

                // Light source.
                GL.PointSize(5.0f);
                GL.Begin(PrimitiveType.Points);
                GL.Color3(1.0f, 1.0f, 1.0f);
                GL.Vertex3(OGL.lightPosition);
                GL.End();

                primitiveCounter++;

                primitiveCounter += rdata.Cube.Draw();
            }
            else
            {
                CubeObject cube = new CubeObject(10);
                primitiveCounter += cube.Draw();
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// OpenGL rendering code itself (separated for clarity).
        /// </summary>
        private void RenderScene()
        {
            // Simulation scene rendering.
            MarblesRenderData rdata = null;

            if (renderer != null &&
                OGL.useShaders)
            {
                lock (renderer)
                    rdata = data;
            }

            if (rdata != null)
            {
                OGL.FormData();

                // Simulated scene.
                primitiveCounter += renderer.Render(OGL, rdata);

                // Light source.
                GL.PointSize(5.0f);
                GL.Begin(PrimitiveType.Points);
                GL.Color3(1.0f, 1.0f, 1.0f);
                GL.Vertex3(OGL.lightPosition);
                GL.End();

                primitiveCounter++;
            }
            else
            {
                // color cube:
                GL.Begin(PrimitiveType.Quads);

                GL.Color3(0.0f, 1.0f, 0.0f);      // Set The Color To Green
                GL.Vertex3(1.0f, 1.0f, -1.0f);    // Top Right Of The Quad (Top)
                GL.Vertex3(-1.0f, 1.0f, -1.0f);   // Top Left Of The Quad (Top)
                GL.Vertex3(-1.0f, 1.0f, 1.0f);    // Bottom Left Of The Quad (Top)
                GL.Vertex3(1.0f, 1.0f, 1.0f);     // Bottom Right Of The Quad (Top)

                GL.Color3(1.0f, 0.5f, 0.0f);      // Set The Color To Orange
                GL.Vertex3(1.0f, -1.0f, 1.0f);    // Top Right Of The Quad (Bottom)
                GL.Vertex3(-1.0f, -1.0f, 1.0f);   // Top Left Of The Quad (Bottom)
                GL.Vertex3(-1.0f, -1.0f, -1.0f);  // Bottom Left Of The Quad (Bottom)
                GL.Vertex3(1.0f, -1.0f, -1.0f);   // Bottom Right Of The Quad (Bottom)

                GL.Color3(1.0f, 0.0f, 0.0f);      // Set The Color To Red
                GL.Vertex3(1.0f, 1.0f, 1.0f);     // Top Right Of The Quad (Front)
                GL.Vertex3(-1.0f, 1.0f, 1.0f);    // Top Left Of The Quad (Front)
                GL.Vertex3(-1.0f, -1.0f, 1.0f);   // Bottom Left Of The Quad (Front)
                GL.Vertex3(1.0f, -1.0f, 1.0f);    // Bottom Right Of The Quad (Front)

                GL.Color3(1.0f, 1.0f, 0.0f);      // Set The Color To Yellow
                GL.Vertex3(1.0f, -1.0f, -1.0f);   // Bottom Left Of The Quad (Back)
                GL.Vertex3(-1.0f, -1.0f, -1.0f);  // Bottom Right Of The Quad (Back)
                GL.Vertex3(-1.0f, 1.0f, -1.0f);   // Top Right Of The Quad (Back)
                GL.Vertex3(1.0f, 1.0f, -1.0f);    // Top Left Of The Quad (Back)

                GL.Color3(0.0f, 0.0f, 1.0f);      // Set The Color To Blue
                GL.Vertex3(-1.0f, 1.0f, 1.0f);    // Top Right Of The Quad (Left)
                GL.Vertex3(-1.0f, 1.0f, -1.0f);   // Top Left Of The Quad (Left)
                GL.Vertex3(-1.0f, -1.0f, -1.0f);  // Bottom Left Of The Quad (Left)
                GL.Vertex3(-1.0f, -1.0f, 1.0f);   // Bottom Right Of The Quad (Left)

                GL.Color3(1.0f, 0.0f, 1.0f);      // Set The Color To Violet
                GL.Vertex3(1.0f, 1.0f, -1.0f);    // Top Right Of The Quad (Right)
                GL.Vertex3(1.0f, 1.0f, 1.0f);     // Top Left Of The Quad (Right)
                GL.Vertex3(1.0f, -1.0f, 1.0f);    // Bottom Left Of The Quad (Right)
                GL.Vertex3(1.0f, -1.0f, -1.0f);   // Bottom Right Of The Quad (Right)

                GL.End();

                primitiveCounter += 12;
            }
        }
        public override void Draw(Point cursorCoordinates)
        {
            SystemCoordinates P1, P3, P4, P6;

            if (count == 0)
            {
                OGL.DrawFilledCircle(new Pen(Color.Yellow), cursorCoordinates, 5);
            }
            if (count == 1)
            {
                OGL.DrawFilledCircle(new Pen(Color.Yellow), cursorCoordinates, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p1, 5);
            }
            if (count == 2 && cursorCoordinates != p1.ToScreen() && cursorCoordinates != p2.ToScreen())
            {
                Line            x = p1 + p2;
                DoubleExtention l = x.DistanceToPoint(cursorCoordinates);
                Line            z = x.BuildOrthogonalLine(p2);
                z.BuildAngle();
                if (z.AngleForOnePointLines == new Angle(90, false) || z.AngleForOnePointLines == new Angle(90, false))
                {
                    z.FirstEnd  = new SystemCoordinates(p2.X, p2.Y + l);
                    z.SecondEnd = new SystemCoordinates(p2.X, p2.Y - l);
                }
                else
                {
                    z.FirstEnd  = new SystemCoordinates(p2.X + l * z.AngleForOnePointLines.cos(), p2.Y + l * z.AngleForOnePointLines.sin());
                    z.SecondEnd = new SystemCoordinates(p2.X - l * z.AngleForOnePointLines.cos(), p2.Y + l * z.AngleForOnePointLines.sin());
                }
                Line u = x.BuildOrthogonalLine(p1);
                u.BuildAngle();
                if (u.AngleForOnePointLines == new Angle(90, false) || u.AngleForOnePointLines == new Angle(90, false))
                {
                    u.FirstEnd  = new SystemCoordinates(p1.X, p1.Y + l);
                    u.SecondEnd = new SystemCoordinates(p1.X, p1.Y - l);
                }
                else
                {
                    u.FirstEnd  = new SystemCoordinates(p1.X + l * u.AngleForOnePointLines.cos(), p1.Y + l * u.AngleForOnePointLines.sin());
                    u.SecondEnd = new SystemCoordinates(p1.X - l * u.AngleForOnePointLines.cos(), p1.Y + l * u.AngleForOnePointLines.sin());
                }
                P1 = z.FirstEnd;
                P3 = z.SecondEnd;
                P4 = u.FirstEnd;
                P6 = u.SecondEnd;
                u  = new Line(P1, P3, false);
                z  = new Line(P4, P6, false);
                u.Drawer(2);
                z.Drawer(2);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), P1, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), P3, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), P4, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), P6, 5);
            }
            if (count == 3 && cursorCoordinates != p1.ToScreen() && cursorCoordinates != p3.ToScreen() && cursorCoordinates != p4.ToScreen() && cursorCoordinates != p6.ToScreen())
            {
                Line z = new Line(p1, p3, false);
                Line u = new Line(p4, p6, false);
                z.Drawer(2);
                u.Drawer(2);

                if (p1.Distance(p4) < p1.Distance(p6))
                {
                    Circle beta  = null;
                    Line   alpha = null;
                    if (SystemCoordinates.InOneLine(p1, cursorCoordinates, p4))
                    {
                        alpha = new Line(p1, p4, false);
                    }
                    else
                    {
                        beta = new Circle(p1, cursorCoordinates, p4);
                    }
                    if (alpha != null)
                    {
                        alpha.Drawer(Color.Black, 2);
                    }
                    if (beta != null)
                    {
                        beta.Draw(false);
                    }
                }
                else
                {
                    Circle beta  = null;
                    Line   alpha = null;
                    if (SystemCoordinates.InOneLine(p1, cursorCoordinates, p6))
                    {
                        alpha = new Line(p1, p6, false);
                    }
                    else
                    {
                        beta = new Circle(p1, cursorCoordinates, p6);
                    }
                    if (alpha != null)
                    {
                        alpha.Drawer(Color.Black, 2);
                    }
                    if (beta != null)
                    {
                        beta.Draw(false);
                    }
                }
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p1, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p3, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p4, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p6, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), cursorCoordinates, 5);
            }
            if (count == 4 && cursorCoordinates != p1.ToScreen() && cursorCoordinates != p3.ToScreen() && cursorCoordinates != p4.ToScreen() && cursorCoordinates != p6.ToScreen())
            {
                Line z = new Line(p1, p3, false);
                Line u = new Line(p4, p6, false);
                z.Drawer(2);
                u.Drawer(2);
                if (p1.Distance(p4) < p1.Distance(p6))
                {
                    Line   beta_x = null;
                    Line   alpha_x = null;
                    Circle alpha = null, beta = null;
                    if (SystemCoordinates.InOneLine(p1, p2, p4))
                    {
                        beta_x = new Line(p1, p4, false);
                    }
                    else
                    {
                        beta = new Circle(p1, p2, p4);
                    }
                    if (SystemCoordinates.InOneLine(p3, cursorCoordinates, p6))
                    {
                        alpha_x = new Line(p3, p6, false);
                    }
                    else
                    {
                        alpha = new Circle(p3, cursorCoordinates, p6);
                    }
                    if (beta != null)
                    {
                        beta.Draw(false);
                    }
                    if (alpha != null)
                    {
                        alpha.Draw(false);
                    }
                    if (beta_x != null)
                    {
                        beta_x.Drawer(2);
                    }
                    if (alpha_x != null)
                    {
                        alpha_x.Drawer(2);
                    }
                }
                else
                {
                    Line   beta_x  = null;
                    Line   alpha_x = null;
                    Circle beta    = null;
                    Circle alpha   = null;
                    if (SystemCoordinates.InOneLine(p1, p2, p6))
                    {
                        beta_x = new Line(p1, p6, false);
                    }
                    else
                    {
                        beta = new Circle(p1, p2, p6);
                    }
                    if (SystemCoordinates.InOneLine(p3, cursorCoordinates, p4))
                    {
                        alpha_x = new Line(p3, p4, false);
                    }
                    else
                    {
                        alpha = new Circle(p3, cursorCoordinates, p4);
                    }
                    if (beta != null)
                    {
                        beta.Draw(false);
                    }
                    if (alpha != null)
                    {
                        alpha.Draw(false);
                    }
                    if (beta_x != null)
                    {
                        beta_x.Drawer(2);
                    }
                    if (alpha_x != null)
                    {
                        alpha_x.Drawer(2);
                    }
                }
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p1, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p3, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p4, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p6, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p2, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), cursorCoordinates, 5);
            }
            if (count == 5)
            {
                Line z = new Line(p1, p3, false);
                Line u = new Line(p4, p6, false);
                z.Drawer(2);
                u.Drawer(2);
                if (p1.Distance(p4) < p1.Distance(p6))
                {
                    Line   beta_x = null;
                    Line   alpha_x = null;
                    Circle alpha = null, beta = null;
                    if (SystemCoordinates.InOneLine(p1, p2, p4))
                    {
                        beta_x = new Line(p1, p4, false);
                    }
                    else
                    {
                        beta = new Circle(p1, p2, p4);
                    }
                    if (SystemCoordinates.InOneLine(p3, p5, p6))
                    {
                        alpha_x = new Line(p3, p6, false);
                    }
                    else
                    {
                        alpha = new Circle(p3, p5, p6);
                    }
                    if (beta != null)
                    {
                        beta.Draw(false);
                    }
                    if (alpha != null)
                    {
                        alpha.Draw(false);
                    }
                    if (beta_x != null)
                    {
                        beta_x.Drawer(2);
                    }
                    if (alpha_x != null)
                    {
                        alpha_x.Drawer(2);
                    }
                }
                else
                {
                    Line   beta_x  = null;
                    Line   alpha_x = null;
                    Circle beta    = null;
                    Circle alpha   = null;
                    if (SystemCoordinates.InOneLine(p1, p2, p6))
                    {
                        beta_x = new Line(p1, p6, false);
                    }
                    else
                    {
                        beta = new Circle(p1, p2, p6);
                    }
                    if (SystemCoordinates.InOneLine(p3, p5, p4))
                    {
                        alpha_x = new Line(p3, p4, false);
                    }
                    else
                    {
                        alpha = new Circle(p3, p5, p4);
                    }
                    if (beta != null)
                    {
                        beta.Draw(false);
                    }
                    if (alpha != null)
                    {
                        alpha.Draw(false);
                    }
                    if (beta_x != null)
                    {
                        beta_x.Drawer(2);
                    }
                    if (alpha_x != null)
                    {
                        alpha_x.Drawer(2);
                    }
                }
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p1, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p3, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p4, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p6, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p2, 5);
                OGL.DrawFilledCircle(new Pen(Color.Yellow), p5, 5);
            }
        }
Ejemplo n.º 19
0
 private void GenerateEmptyBuffers()
 {
     VAO = (int)OGL.GenVertexArray();
     VBO = (int)OGL.GenBuffer();
     IBO = (int)OGL.GenBuffer();
 }