Exemplo n.º 1
0
        private void BuildSlicesEvenly()
        {
            var sectionNumber = _settings.Slices.Count;
            var fanWidth      = (float)Math.PI * 2 / sectionNumber;
            var mid           = 0.0f;

            for (var i = 0; i < sectionNumber; i++)
            {
                var slice = new WheelSlice()
                {
                    MidValue = mid,
                    MinValue = mid - (fanWidth / 2.0f),
                    MaxValue = mid + (fanWidth / 2.0f),
                    Value    = i,
                };

                if (slice.MaxValue - fanWidth < -Math.PI)
                {
                    mid            = 3.14f;
                    slice.MidValue = mid;
                    slice.MinValue = Math.Abs(slice.MaxValue);
                    slice.Name     = sliceNames[i];
                }
                mid -= fanWidth;
                _slices.Add(slice);
            }
        }
Exemplo n.º 2
0
        private void BuildSlicesUnEvenly()
        {
            var sectionNumber = _settings.Slices.Count;
            var fanWidth      = (float)Math.PI * 2 / sectionNumber;
            var mid           = 0.0f;

            for (var i = 0; i < sectionNumber; i++)
            {
                var slice = new WheelSlice()
                {
                    MidValue = mid,
                    MinValue = mid - (fanWidth / 2.0f),
                    MaxValue = mid + (fanWidth / 2.0f),
                    Value    = i,
                };
                mid -= fanWidth;
                if (slice.MinValue < -Math.PI)
                {
                    mid  = -mid;
                    mid -= fanWidth;
                }
                _slices.Add(slice);
            }
        }