Rotate() public méthode

public Rotate ( float angle, float x0, float y0 ) : bool
angle float
x0 float
y0 float
Résultat bool
Exemple #1
0
        public override void Draw(OpenGLControl glControl)
        {
            //Prepare data
            long x2 = tmpX2;
            long y2 = tmpY2;

            p = 5 / 4 - radius;

            start = new Point(0, radius);

            base.Draw(glControl);
            int k  = 0;
            var gl = glControl.OpenGL;

            gl.PushMatrix();
            Affine.Rotate(center, gocXoay, glControl.OpenGL);
            gl.PointSize(thickness);
            gl.Begin(OpenGL.GL_POINTS);
            while (true)
            {
                if (start.X > start.Y)
                {
                    //Khi vẽ xong hình tròn
                    gl.End();
                    gl.Flush();
                    if (veDdk == true)
                    {
                        DrawControlPoint(glControl);
                    }
                    gl.PopMatrix();
                    return;
                }
                //Vẽ điểm cũ,  và 7 điểm đối xứng của nó
                gl.Vertex(center.X - start.X, glControl.Height - (center.Y - start.Y));
                gl.Vertex(center.X + start.X, glControl.Height - (center.Y + start.Y));
                gl.Vertex(center.X - start.X, glControl.Height - (center.Y + start.Y));
                gl.Vertex(center.X + start.X, glControl.Height - (center.Y - start.Y));
                gl.Vertex(center.X + start.Y, glControl.Height - (center.Y + start.X));
                gl.Vertex(center.X - start.Y, glControl.Height - (center.Y + start.X));
                gl.Vertex(center.X + start.Y, glControl.Height - (center.Y - start.X));
                gl.Vertex(center.X - start.Y, glControl.Height - (center.Y - start.X));
                start.X++;
                x2 = x2 + 2;
                if (p < 0)
                {
                    p = p + x2 + 1;
                }
                else
                {
                    start.Y--;
                    y2 = y2 - 2;
                    p  = p + x2 - y2 + 1;
                }
                k++;
            }
        }
        public override void Draw(OpenGLControl glControl)
        {
            base.Draw(glControl);
            var gl = glControl.OpenGL;

            gl.PushMatrix();
            Affine.Rotate(center, gocXoay, glControl.OpenGL);
            gl.Begin(OpenGL.GL_LINES);
            gl.Vertex(upLeft.X, glControl.Height - upLeft.Y);
            gl.Vertex(downRight.X, glControl.Height - downRight.Y);
            gl.End();
            if (veDdk == true)
            {
                DrawControlPoint(glControl);
            }
            gl.PopMatrix();
        }
        public override void Draw(OpenGLControl glControl)
        {
            base.Draw(glControl);
            FindRadius();
            var tmpCenterY = glControl.Height - center.Y;
            var gl         = glControl.OpenGL;

            gl.PushMatrix();
            Affine.Rotate(center, gocXoay, glControl.OpenGL);
            gl.Begin(OpenGL.GL_LINE_LOOP);
            for (double i = 0; i < 360; i += 0.1)
            {
                double rad = i * Math.PI / 180;
                gl.Vertex(center.X + radiusX * Math.Cos(rad), tmpCenterY + radiusY * Math.Sin(rad));
            }
            gl.End();
            if (veDdk == true)
            {
                DrawControlPoint(glControl);
            }
            gl.PopMatrix();
        }