Exemplo n.º 1
0
        public static EECOut ConvertEndPoint(EasyEllipseInput eei)
        {
            float rt1 = (eei.t1 / 180f) * (float)Math.PI;
            float rt2 = (eei.t2 / 180f) * (float)Math.PI;
            float rot = (float)Math.PI * (eei.rotation / 180f);
            float cr  = (float)Math.Cos(rot);
            float sr  = (float)Math.Sin(rot);

            //get point 1
            float x1, y1;

            getpoint(rt1, cr, sr, eei.rx, eei.ry, out x1, out y1);

            // get point 2
            float x2, y2;

            getpoint(rt2, cr, sr, eei.rx, eei.ry, out x2, out y2);

            // the end point is desired start, minus our start, plus our end.
            return(new EECOut()
            {
                x = eei.start_x - x1 + x2,
                y = eei.start_y - y1 + y2,
                reflex = Math.Abs(eei.t2 - eei.t1) > 180f,
                clockwise = true
            });
        }
Exemplo n.º 2
0
        public static IEnumerable <System.Drawing.PointF> Generate(EasyEllipseInput eei)
        {
            float rt1 = (eei.t1 / 180f) * (float)Math.PI;
            float rt2 = (eei.t2 / 180f) * (float)Math.PI;
            float rot = (float)Math.PI * (eei.rotation / 180f);
            float cr  = (float)Math.Cos(rot);
            float sr  = (float)Math.Sin(rot);

            // init point get offset to start
            float x, y;

            getpoint(rt1, cr, sr, eei.rx, eei.ry, out x, out y);
            float of_x = eei.start_x - x;
            float of_y = eei.start_y - y;

            foreach (double sd in EllipseUtil.GetThetas(rt1, rt2, eei.resolution, eei.rx, eei.ry))
            {
                float fsd = (float)sd;
                getpoint(rt1, cr, sr, eei.rx, eei.ry, out x, out y);
                yield return(new System.Drawing.PointF(x + of_x, y + of_y));
            }
        }