System.Drawing.PieChart.PieChart3D.GetForemostPieSlice C# (CSharp) Method

GetForemostPieSlice() private method

Return the index of the foremost pie slice i.e. the one crossing 90 degrees boundary.
private GetForemostPieSlice ( PieSlice pieSlices ) : int
pieSlices PieSlice /// Array of PieSlice objects to examine. ///
return int
        private int GetForemostPieSlice(PieSlice[] pieSlices)
        {
            Debug.Assert(pieSlices != null && pieSlices.Length > 0);
            for (int i = 0; i < pieSlices.Length; ++i) {
                PieSlice pieSlice = pieSlices[i];
                if (((pieSlice.StartAngle <= 90) && ((pieSlice.StartAngle + pieSlice.SweepAngle) >= 90)) ||
                    ((pieSlice.StartAngle + pieSlice.SweepAngle > 360) && ((pieSlice.StartAngle) <= 450) && (pieSlice.StartAngle + pieSlice.SweepAngle) >= 450)) {
                    return i;
                }
            }
            Debug.Assert(false, "Foremost pie slice not found");
            return -1;
        }