Esempio n. 1
0
        public static double[] getArcAngle(CircleArcGeometry arc, bool ccw)
        {
            double xb = 0, yb = 0, xm = 0, ym = 0, xe = 0, ye = 0;

            arc.GetThreePoints(ref xe, ref ye, ref xm, ref ym, ref xb, ref yb);



            double xc     = arc.CenterX;
            double yc     = arc.CenterY;
            double radius = arc.Radius;

            double dx1  = xb - xc;
            double dy1  = yb - yc;
            double ang1 = Math.Atan2(dx1, dy1);

            double ang2  = Math.Atan2(xe - xc, ye - yc);
            double sweep = ang2 - ang1;

            if (sweep < 0)
            {
                sweep = 2 * Math.PI + sweep;
            }

            return(new double[] { sweep, ang1 });
        }
Esempio n. 2
0
        public static Tuple <double, double> GetArcAngle(CircleArcGeometry arc)
        {
            double xb = 0, yb = 0, xm = 0, ym = 0, xe = 0, ye = 0;

            arc.GetThreePoints(ref xe, ref ye, ref xm, ref ym, ref xb, ref yb);

            double xc = arc.CenterX;
            double yc = arc.CenterY;

            double dx1  = xb - xc;
            double dy1  = yb - yc;
            double ang1 = Math.Atan2(dx1, dy1);

            double ang2  = Math.Atan2(xe - xc, ye - yc);
            double sweep = ang2 - ang1;

            if (sweep < 0)
            {
                sweep = 2 * Math.PI + sweep;
            }
            return(new Tuple <double, double>(sweep, ang1));
        }