Exemplo n.º 1
0
        public static Color GetColorReversed(CPoint pt, CProjection projection)
        {
            var rp = pt.RG(projection);
            int cnt;
            var end = pt.ReverseTrackEndPoint(Config.ReserverInterestedPoint, projection, out cnt);

            if (cnt >= Config.Count)
            {
                return(Config.Black);
            }
            var   last = end;
            var   p    = Config.ReserverInterestedPoint;
            Color clr;

            if (last.C0 > 0)
            {
                clr = rp.G < 0
                            ? (last.C1 < p.C1 ? Config.Yellow : Config.Green)
                            : (last.C1 < p.C1 ? Config.Red : Config.Blue);
            }
            else
            {
                clr = rp.G < 0
                            ? (last.C1 > p.C1 ? Config.Yellow : Config.Green)
                            : (last.C1 > p.C1 ? Config.Red : Config.Blue);
            }
            var resClr = clr;

            return(resClr);
        }
Exemplo n.º 2
0
 private static IEnumerable <KeyValuePair <CPoint, RGPoint> > GetC1C2ArcPositive(double h1, double h2, double yacc, int sgn)
 {
     yacc = yacc / 100;
     for (var y = h1; y <= h2; y += yacc)
     {
         var c2 = y;
         var c1 = Math.Sqrt(1 - Math.Pow(c2, 2));
         var rd = c1 * c1 + c2 * c2;
         var c0 = 1 - rd;
         if (rd <= 1)
         {
             c0 = sgn * Math.Sqrt(c0);
             var cpt = new CPoint(c0, c1, c2);
             var rg  = cpt.RG(CProjection.C1C2);
             if (rg.G >= 0)
             {
                 yield return(new KeyValuePair <CPoint, RGPoint>(cpt, rg));
             }
         }
     }
 }
Exemplo n.º 3
0
 private static IEnumerable <KeyValuePair <CPoint, RGPoint> > GetC0C1ArcPositive(double h1, double h2, double xacc, int sgn)
 {
     xacc = xacc / 100;
     for (var x = h1; x <= h2; x += xacc)
     {
         var c0 = x;
         var c1 = Math.Sqrt(1 - Math.Pow(c0, 2));
         var rd = c0 * c0 + c1 * c1;
         var c2 = 1 - rd;
         if (rd <= 1)
         {
             c2 = sgn * Math.Sqrt(c2);
             var cpt = new CPoint(c0, c1, c2);
             var rg  = cpt.RG(CProjection.C0C1);
             if (rg.G >= 0)
             {
                 yield return(new KeyValuePair <CPoint, RGPoint>(cpt, rg));
             }
         }
     }
 }
Exemplo n.º 4
0
 private static IEnumerable <KeyValuePair <CPoint, RGPoint> > GetC1C2TrianglePositive(double h1, double h2, double xacc, double yacc, int sgn)
 {
     CorrectAcc(h1, h2, ref xacc, ref yacc);
     for (var x = 0.0; x <= 1.0; x += xacc)
     {
         for (var y = h1; y <= h2; y += yacc)
         {
             var c1 = x;
             var c2 = y;
             var rd = c1 * c1 + c2 * c2;
             var c0 = 1 - rd;
             if (rd <= 1)
             {
                 c0 = sgn * Math.Sqrt(c0);
                 var cpt = new CPoint(c0, c1, c2);
                 var rg  = cpt.RG(CProjection.C1C2);
                 //if (rg.G >= 0)
                 //{
                 yield return(new KeyValuePair <CPoint, RGPoint>(cpt, rg));
                 //}
             }
         }
     }
 }
Exemplo n.º 5
0
 private static IEnumerable <KeyValuePair <CPoint, RGPoint> > GetC0C1TrianglePositive(double h1, double h2, double xacc, double yacc, int sgn)
 {
     CorrectAcc(h1, h2, ref xacc, ref yacc);
     for (var x = h1; x <= h2; x += xacc)
     {
         for (var y = 0.0; y <= 1.0; y += yacc)
         {
             var c0 = x;
             var c1 = y;
             var rd = c0 * c0 + c1 * c1;
             var c2 = 1 - rd;
             if (rd <= 1)
             {
                 c2 = sgn * Math.Sqrt(c2);
                 var cpt = new CPoint(c0, c1, c2);
                 var rg  = cpt.RG(CProjection.C0C1);
                 if (rg.G >= 0)
                 {
                     yield return(new KeyValuePair <CPoint, RGPoint>(cpt, rg));
                 }
             }
         }
     }
 }
Exemplo n.º 6
0
        private static Color GetBgColor(CPoint pt, CProjection projection)
        {
            var rp = pt.RG(projection);

            return(rp.G < 0 ? Config.Green : Config.Blue);
        }