Ejemplo n.º 1
0
        private void Form1_Click(object sender, EventArgs e)
        {
            var mouseEv = (MouseEventArgs)e;

            if (mouseEv.Button == MouseButtons.Left)
            {
                _points.Add(new Point(mouseEv.X, mouseEv.Y));
                _count++;
                if (IsPoint.Checked)
                {
                    _drawPoint.Draw(_points.Last());
                    _points = new List <Point>();
                    _count  = 0;
                    return;
                }
                if (_count == 3)
                {
                    if (IsTriangle.Checked)
                    {
                        _drawTriangle.Draw(_points[0], _points[1], _points[2]);
                        if (IsFill.Checked)
                        {
                            _drawTriangle.DrawFill(_points[0], _points[1], _points[2]);
                        }
                    }
                    _count  = 0;
                    _points = new List <Point>();
                }
                if (_count == 2 && !IsTriangle.Checked)
                {
                    var point1 = _points[0];
                    var point2 = _points[1];
                    if (IsLine.Checked)
                    {
                        _drawLine.Draw(point1, point2);
                    }
                    if (IsRectangle.Checked)
                    {
                        _drawRectangles.Draw(point1, point2);
                        if (IsFill.Checked)
                        {
                            _drawRectangles.FillDraw(point1, point2);
                        }
                    }

                    if (IsCircle.Checked)
                    {
                        _drawCircle.Draw(point1, point2);
                        if (IsFill.Checked)
                        {
                            _drawCircle.DrawFill(point1, point2);
                        }
                    }
                    ;

                    _points = new List <Point>();
                    _count  = 0;
                }
            }
        }
        void Update()
        {
            drawCircle1.Draw();


            //if (Vector3.Angle(body.right, target.position - body.position) > 90f) side = "left"; else side = "right";
            //angle = angle360(transform.position, target.position, Vector3.right);
            Debug.Log("angle:" + angle);
            //angle = transform.rotation.eulerAngles.y + 90.0f;
            //Debug.Log(transform.rotation.eulerAngles.y);
            angle = GetAngle();
            bis   = new Vector3(
                transform.position.x + 1.0f * Mathf.Cos(Mathf.Deg2Rad * 45.0f),
                transform.position.y,
                transform.position.z + 1.0f * Mathf.Sin(Mathf.Deg2Rad * 45.0f)
                );

            Debug.DrawLine(transform.position, new Vector3(transform.position.x + 50.0f, transform.position.y, transform.position.z), Color.red);  // x axis
            Debug.DrawLine(transform.position, new Vector3(transform.position.x, transform.position.y, transform.position.z + 50.0f), Color.blue); // z axis
            Debug.DrawLine(transform.position, bis, Color.yellow);
            Debug.DrawLine(transform.position, GetVec3(2.0f), Color.cyan);
            //Debug.DrawLine(transform.position, GetVec3(2.0f), Color.cyan);
            //Debug.DrawLine(transform.position, GetVec3(3.0f), Color.cyan);
            //Debug.DrawLine(transform.position, GetVec3(4.0f), Color.cyan);

            //Debug.DrawLine(transform.position, vec3 * 0.0f, Color.cyan);

            //vec_1a = transform.position +  CalcVec3(1,1,1);
            //Debug.DrawLine(transform.position, vec_1a, Color.cyan);
            //Debug.DrawLine(GetVec3(1.0f),vec_1a,Color.yellow);

            //vec_2a = transform.position + CalcVec3(2, 1, 1);
            //Debug.DrawLine(transform.position, vec_2a, Color.cyan);
            //Debug.DrawLine(GetVec3(2.0f), vec_2a, Color.yellow);

            CalcGraph();
            DrawGraph();

            //Debug.DrawLine(Vector3.zero, vec3*4, Color.cyan);
            //Debug.DrawLine(Vector3.zero, vec_2a, Color.red);
            //Debug.DrawLine(vec3 * 1, vec_1a, Color.grey);
            //Debug.DrawLine(vec3 * 2, vec_2a, Color.grey);
            //Debug.DrawLine(vec3, yVec3, Color.yellow);
        }
Ejemplo n.º 3
0
 public void Draw()
 {
     draw.Draw();
 }