예제 #1
0
        static void SampleArc(Ellipse_Input ei, Ellipse_Output[] eo, bool big, bool clockwise, double resolution, Assignor ass)
        {
            int usl; double t1, dt; String dummy;

            GeometryLib.Ellipse.FindArc(ei, eo, big, clockwise, out usl, out t1, out dt, out dummy);
            var us = eo[usl];

            double s_rot = Math.Sin(-(ei.theta * Math.PI) / 180.0);
            double c_rot = Math.Cos(-(ei.theta * Math.PI) / 180.0);
            double rt1   = t1 * Math.PI / 180.0;
            double rdt   = dt * Math.PI / 180.0;

            foreach (double theta_now in EllipseUtil.GetThetas(rt1, rdt, resolution, ei.rx, ei.ry))
            {
                double s     = Math.Sin(theta_now);
                double c     = Math.Cos(theta_now);
                double x_now = c * us.rx;
                double y_now = s * us.ry;
                ass(x_now * c_rot - y_now * s_rot + us.X, x_now * s_rot + y_now * c_rot + us.Y);
            }
        }
예제 #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));
            }
        }