Ejemplo n.º 1
0
        public LineItem CurveOf(QuoteHelper.PriceAdapter PriceTranslator, List <Double> dateValues, List <Double> prices, Polygon cycleMapper, bool noSmoothing)
        {
            if (PriceTranslator == null)
            {
                return(null);
            }

            List <Double> priceValues = new List <Double>();
            double        priceDegree;
            Double        factor = Range / 360;

            foreach (Double price in prices)
            {
                if (PriceTranslator.Rule == QuoteHelper.PriceMappingRules.Filled || PriceTranslator.Rule == QuoteHelper.PriceMappingRules.FilledPivots)
                {
                    priceDegree = PriceTranslator.IndexOf(price).Normalize();
                    priceDegree = factor * priceDegree + Min;
                }
                else
                {
                    double index = PriceTranslator.IndexOf(price);
                    priceDegree = cycleMapper.AngleOf(index).Degrees;
                }
                priceValues.Add(priceDegree);
            }

            return(CurveOf("$", dateValues, priceValues, System.Drawing.Color.DarkGray, SymbolType.Triangle, noSmoothing));
        }
Ejemplo n.º 2
0
        private static void RelativityTest(Polygon shape)
        {
            List <Double> numbers = new List <double>
            {
                104.96, 1429.01, 386.85, 1558.95, 325.89, 1510.17, 1025.13,
                1047.83, 2245.43, 1339.2, 1783.01, 998.23, 1165.67, 6124.04, 1664.93, 1814.75,
                3478.01, 2639.76, 3361.39, 3181.66
            };
            //List<Double> numbers = new List<double> { 44.0, 45, 46, 65.0, 122.0, 90.0, 210.0, 211.0, 313.0, 315.0, 330, 360, 388, 403, 450, -20, -30, -330 };

            List <Angle> angles = (from number in numbers
                                   select shape.AngleOf(number)).ToList();

            StringBuilder sb = new StringBuilder();

            Aspects aspect;

            Console.WriteLine("Special Angles: ");
            for (int i = 0; i < angles.Count - 1; i++)
            {
                if (shape.IsOutstanding(angles[i]))
                {
                    Console.WriteLine("{0} @ {1}", numbers[i], angles[i]);
                }
            }

            for (int i = 0; i < angles.Count - 1; i++)
            {
                for (int j = i + 1; j < angles.Count; j++)
                {
                    aspect = shape.AspectBetween(angles[i], angles[j]);

                    if (aspect != null)
                    {
                        Angle theAngle = angles[j] - angles[i];

                        Double orb = theAngle.Degrees - aspect.Degrees;

                        sb.AppendFormat("{0}{1} vs {2}{3}: {4}, Orb={5}\r\n",
                                        numbers[i], angles[i], numbers[j], angles[j], aspect, orb);
                    }
                }
            }

            Console.WriteLine(sb.ToString());
        }
Ejemplo n.º 3
0
        public static void TestReverse(Polygon shape)
        {
            //Console.WriteLine("\r\n{0}-------", shape);
            for (double index = 8.8; index < 61.0; index = (index + 0.1).Round(1))
            {
                int    cycle   = shape.RoundOf(index);
                Angle  angle   = shape.AngleOf(index);
                double reverse = shape.IndexOf(cycle, angle).Round(2);

                if (reverse != index)
                {
                    Console.WriteLine("{0}: in cycle {1}, Angle = {2}, back destination {3}", index, cycle, angle, reverse);
                }
                //if (shape == Polygon.SquareNine)
                //{
                //    double reverse2 = SquareNine.indexOf(cycleNum, Position).Round(2);

                //    //if (reverse != indexOfSource || Math.Abs(Degrees2 - Position) > 0.00001)
                //        Console.WriteLine("{0}: in cycle {1}, Angle = {2}, back destination {3}", indexOfSource, cycleNum, distanceDynamic, reverse);
                //}

                //Console.WriteLine("{0}: in cycle {1}, distanceDynamic={2}, reversed back destination {3}", indexOfSource, cycle, distanceDynamic, reverse);
            }
        }