Exemplo n.º 1
0
        void buildSectorsEven()
        {
            float fanWidth = (float)Math.PI * 2 / numberOfSections;
            float mid      = 0f;


            for (int i = 0; i < numberOfSections; i++)
            {
                SMSector sector = new SMSector();
                sector.midValue = mid;
                sector.minValue = mid - (fanWidth / 2);
                sector.maxValue = mid + (fanWidth / 2);
                sector.sector   = i;

                if (sector.maxValue - fanWidth < -Math.PI)
                {
                    mid             = (float)Math.PI;
                    sector.midValue = mid;
                    sector.minValue = Math.Abs(sector.maxValue);
                }
                mid -= fanWidth;
                sectors.Add(sector);
                //Console.WriteLine(string.Format("Sector {3} {0} {1} {2}", sector.minValue, sector.midValue, sector.maxValue, i));
            }
        }
Exemplo n.º 2
0
        void buildSectorsOdd()
        {
            float fanWidth = (float)Math.PI * 2 / numberOfSections;
            float mid      = 0f;

            for (int i = 0; i < numberOfSections; i++)
            {
                SMSector sector = new SMSector();
                sector.midValue = mid;
                sector.minValue = mid - (fanWidth / 2);
                sector.maxValue = mid + (fanWidth / 2);
                sector.sector   = i;
                mid            -= fanWidth;
                if (mid < -Math.PI)
                {
                    mid  = -mid;
                    mid -= fanWidth;
                }

                sectors.Add(sector);
                //Console.WriteLine(string.Format("cl is {0}", sector));
            }
        }