public bool DrawPointsToCenter(ref COPCoordinates coord)
        {
            bool           result         = false;
            COPCoordinates cOPCoordinates = (COPCoordinates)0;

            if (this.Area3DStyle.Perspective != 0)
            {
                if ((coord & COPCoordinates.X) == COPCoordinates.X)
                {
                    if ((this.visibleSurfaces & SurfaceNames.Left) == (SurfaceNames)0 && (this.visibleSurfaces & SurfaceNames.Right) == (SurfaceNames)0)
                    {
                        result = true;
                    }
                    cOPCoordinates |= COPCoordinates.X;
                }
                if ((coord & COPCoordinates.Y) == COPCoordinates.Y)
                {
                    if ((this.visibleSurfaces & SurfaceNames.Top) == (SurfaceNames)0 && (this.visibleSurfaces & SurfaceNames.Bottom) == (SurfaceNames)0)
                    {
                        result = true;
                    }
                    cOPCoordinates |= COPCoordinates.Y;
                }
                if ((coord & COPCoordinates.Z) == COPCoordinates.Z)
                {
                    if ((this.visibleSurfaces & SurfaceNames.Front) == (SurfaceNames)0 && (this.visibleSurfaces & SurfaceNames.Back) == (SurfaceNames)0)
                    {
                        result = true;
                    }
                    cOPCoordinates |= COPCoordinates.Z;
                }
            }
            return(result);
        }
 public PointsDrawingOrderComparer(ChartArea area, bool selection, COPCoordinates coord)
 {
     this.area      = area;
     this.selection = selection;
     if (area.DrawPointsToCenter(ref coord))
     {
         this.areaProjectionCenter = area.GetCenterOfProjection(coord);
     }
 }
        internal Point3D GetCenterOfProjection(COPCoordinates coord)
        {
            Point3D[] array = new Point3D[2]
            {
                new Point3D(base.PlotAreaPosition.X, base.PlotAreaPosition.Bottom(), 0f),
                new Point3D(base.PlotAreaPosition.Right(), base.PlotAreaPosition.Y, areaSceneDepth)
            };
            CheckSurfaceOrientation(coord, array[0], array[1], out bool xSameOrientation, out bool ySameOrientation, out bool zSameOrientation);
            Point3D point3D = new Point3D(xSameOrientation ? float.NaN : 0f, ySameOrientation ? float.NaN : 0f, zSameOrientation ? float.NaN : 0f);

            if (((coord & COPCoordinates.X) != COPCoordinates.X || xSameOrientation) && ((coord & COPCoordinates.Y) != COPCoordinates.Y || ySameOrientation) && ((coord & COPCoordinates.Z) != COPCoordinates.Z || zSameOrientation))
            {
                return(point3D);
            }
            SizeF sizeF = new SizeF(0.5f, 0.5f);

            sizeF.Width  = sizeF.Width * 100f / (float)(base.Common.Chart.Width - 1);
            sizeF.Height = sizeF.Height * 100f / (float)(base.Common.Chart.Height - 1);
            bool flag = false;

            while (!flag)
            {
                Point3D point3D2 = new Point3D((array[0].X + array[1].X) / 2f, (array[0].Y + array[1].Y) / 2f, (array[0].Z + array[1].Z) / 2f);
                CheckSurfaceOrientation(coord, array[0], point3D2, out xSameOrientation, out ySameOrientation, out zSameOrientation);
                array[(!xSameOrientation) ? 1 : 0].X = point3D2.X;
                array[(!ySameOrientation) ? 1 : 0].Y = point3D2.Y;
                array[(!zSameOrientation) ? 1 : 0].Z = point3D2.Z;
                flag = true;
                if ((coord & COPCoordinates.X) == COPCoordinates.X && Math.Abs(array[1].X - array[0].X) >= sizeF.Width)
                {
                    flag = false;
                }
                if ((coord & COPCoordinates.Y) == COPCoordinates.Y && Math.Abs(array[1].Y - array[0].Y) >= sizeF.Height)
                {
                    flag = false;
                }
                if ((coord & COPCoordinates.Z) == COPCoordinates.Z && Math.Abs(array[1].Z - array[0].Z) >= sizeF.Width)
                {
                    flag = false;
                }
            }
            if (!float.IsNaN(point3D.X))
            {
                point3D.X = (array[0].X + array[1].X) / 2f;
            }
            if (!float.IsNaN(point3D.Y))
            {
                point3D.Y = (array[0].Y + array[1].Y) / 2f;
            }
            if (!float.IsNaN(point3D.Z))
            {
                point3D.Z = (array[0].Z + array[1].Z) / 2f;
            }
            return(point3D);
        }
 private void CheckSurfaceOrientation(COPCoordinates coord, Point3D point1, Point3D point2, out bool xSameOrientation, out bool ySameOrientation, out bool zSameOrientation)
 {
     Point3D[] array = new Point3D[3];
     xSameOrientation = true;
     ySameOrientation = true;
     zSameOrientation = true;
     if ((coord & COPCoordinates.X) == COPCoordinates.X)
     {
         array[0] = new Point3D(point1.X, base.PlotAreaPosition.Y, 0f);
         array[1] = new Point3D(point1.X, base.PlotAreaPosition.Bottom(), 0f);
         array[2] = new Point3D(point1.X, base.PlotAreaPosition.Bottom(), this.areaSceneDepth);
         this.matrix3D.TransformPoints(array);
         bool flag = ChartGraphics3D.IsSurfaceVisible(array[0], array[1], array[2]);
         array[0] = new Point3D(point2.X, base.PlotAreaPosition.Y, 0f);
         array[1] = new Point3D(point2.X, base.PlotAreaPosition.Bottom(), 0f);
         array[2] = new Point3D(point2.X, base.PlotAreaPosition.Bottom(), this.areaSceneDepth);
         this.matrix3D.TransformPoints(array);
         bool flag2 = ChartGraphics3D.IsSurfaceVisible(array[0], array[1], array[2]);
         xSameOrientation = (flag == flag2);
     }
     if ((coord & COPCoordinates.Y) == COPCoordinates.Y)
     {
         array[0] = new Point3D(base.PlotAreaPosition.X, point1.Y, this.areaSceneDepth);
         array[1] = new Point3D(base.PlotAreaPosition.X, point1.Y, 0f);
         array[2] = new Point3D(base.PlotAreaPosition.Right(), point1.Y, 0f);
         this.matrix3D.TransformPoints(array);
         bool flag = ChartGraphics3D.IsSurfaceVisible(array[0], array[1], array[2]);
         array[0] = new Point3D(base.PlotAreaPosition.X, point2.Y, this.areaSceneDepth);
         array[1] = new Point3D(base.PlotAreaPosition.X, point2.Y, 0f);
         array[2] = new Point3D(base.PlotAreaPosition.Right(), point2.Y, 0f);
         this.matrix3D.TransformPoints(array);
         bool flag2 = ChartGraphics3D.IsSurfaceVisible(array[0], array[1], array[2]);
         ySameOrientation = (flag == flag2);
     }
     if ((coord & COPCoordinates.Z) == COPCoordinates.Z)
     {
         array[0] = new Point3D(base.PlotAreaPosition.X, base.PlotAreaPosition.Y, point1.Z);
         array[1] = new Point3D(base.PlotAreaPosition.X, base.PlotAreaPosition.Bottom(), point1.Z);
         array[2] = new Point3D(base.PlotAreaPosition.Right(), base.PlotAreaPosition.Bottom(), point1.Z);
         this.matrix3D.TransformPoints(array);
         bool flag = ChartGraphics3D.IsSurfaceVisible(array[0], array[1], array[2]);
         array[0] = new Point3D(base.PlotAreaPosition.X, base.PlotAreaPosition.Y, point2.Z);
         array[1] = new Point3D(base.PlotAreaPosition.X, base.PlotAreaPosition.Bottom(), point2.Z);
         array[2] = new Point3D(base.PlotAreaPosition.Right(), base.PlotAreaPosition.Bottom(), point2.Z);
         this.matrix3D.TransformPoints(array);
         bool flag2 = ChartGraphics3D.IsSurfaceVisible(array[0], array[1], array[2]);
         zSameOrientation = (flag == flag2);
     }
 }
        public Point3D GetCenterOfProjection(COPCoordinates coord)
        {
            Point3D[] array = new Point3D[2]
            {
                new Point3D(base.PlotAreaPosition.X, base.PlotAreaPosition.Bottom(), 0f),
                new Point3D(base.PlotAreaPosition.Right(), base.PlotAreaPosition.Y, this.areaSceneDepth)
            };
            bool flag  = default(bool);
            bool flag2 = default(bool);
            bool flag3 = default(bool);

            this.CheckSurfaceOrientation(coord, array[0], array[1], out flag, out flag2, out flag3);
            Point3D point3D = new Point3D((float)(flag ? double.NaN : 0.0), (float)(flag2 ? double.NaN : 0.0), (float)(flag3 ? double.NaN : 0.0));

            if ((coord & COPCoordinates.X) == COPCoordinates.X && !flag)
            {
                goto IL_00b3;
            }
            if ((coord & COPCoordinates.Y) == COPCoordinates.Y && !flag2)
            {
                goto IL_00b3;
            }
            if ((coord & COPCoordinates.Z) == COPCoordinates.Z && !flag3)
            {
                goto IL_00b3;
            }
            return(point3D);

IL_00b3:
            SizeF sizeF = new SizeF(0.5f, 0.5f);

            sizeF.Width  = (float)(sizeF.Width * 100.0 / (float)(base.Common.Chart.Width - 1));
            sizeF.Height = (float)(sizeF.Height * 100.0 / (float)(base.Common.Chart.Height - 1));
            bool flag4 = false;

            while (!flag4)
            {
                Point3D point3D2 = new Point3D((float)((array[0].X + array[1].X) / 2.0), (float)((array[0].Y + array[1].Y) / 2.0), (float)((array[0].Z + array[1].Z) / 2.0));
                this.CheckSurfaceOrientation(coord, array[0], point3D2, out flag, out flag2, out flag3);
                array[(!flag) ? 1 : 0].X  = point3D2.X;
                array[(!flag2) ? 1 : 0].Y = point3D2.Y;
                array[(!flag3) ? 1 : 0].Z = point3D2.Z;
                flag4 = true;
                if ((coord & COPCoordinates.X) == COPCoordinates.X && Math.Abs(array[1].X - array[0].X) >= sizeF.Width)
                {
                    flag4 = false;
                }
                if ((coord & COPCoordinates.Y) == COPCoordinates.Y && Math.Abs(array[1].Y - array[0].Y) >= sizeF.Height)
                {
                    flag4 = false;
                }
                if ((coord & COPCoordinates.Z) == COPCoordinates.Z && Math.Abs(array[1].Z - array[0].Z) >= sizeF.Width)
                {
                    flag4 = false;
                }
            }
            if (!float.IsNaN(point3D.X))
            {
                point3D.X = (float)((array[0].X + array[1].X) / 2.0);
            }
            if (!float.IsNaN(point3D.Y))
            {
                point3D.Y = (float)((array[0].Y + array[1].Y) / 2.0);
            }
            if (!float.IsNaN(point3D.Z))
            {
                point3D.Z = (float)((array[0].Z + array[1].Z) / 2.0);
            }
            return(point3D);
        }
        public ArrayList GetDataPointDrawingOrder(ArrayList seriesNamesList, IChartType chartType, bool selection, COPCoordinates coord, IComparer comparer, int mainYValueIndex, bool sideBySide)
        {
            ChartArea chartArea = (ChartArea)this;
            ArrayList arrayList = new ArrayList();
            double    num       = 1.0;

            if (chartArea.Area3DStyle.Clustered && !chartType.Stacked && sideBySide)
            {
                num = (double)seriesNamesList.Count;
            }
            if (chartType.SupportStackedGroups)
            {
                int numberOfStackGroups = this.GetNumberOfStackGroups(seriesNamesList);
                if (this.Area3DStyle.Clustered && seriesNamesList.Count > 0)
                {
                    num = (double)numberOfStackGroups;
                }
            }
            bool flag = chartArea.IndexedSeries((string[])seriesNamesList.ToArray(typeof(string)));
            int  num2 = 0;

            foreach (object seriesNames in seriesNamesList)
            {
                Series series = base.Common.DataManager.Series[(string)seriesNames];
                if (chartType.SupportStackedGroups && this.stackGroupNames != null)
                {
                    string empty = string.Empty;
                    num2 = this.GetSeriesStackGroupIndex(series, ref empty);
                    if (chartType is StackedColumnChart)
                    {
                        ((StackedColumnChart)chartType).currentStackGroup = empty;
                    }
                    else if (chartType is StackedBarChart)
                    {
                        ((StackedBarChart)chartType).currentStackGroup = empty;
                    }
                }
                Axis axis  = (series.YAxisType == AxisType.Primary) ? chartArea.AxisY : chartArea.AxisY2;
                Axis axis2 = (series.XAxisType == AxisType.Primary) ? chartArea.AxisX : chartArea.AxisX2;
                axis2.GetViewMinimum();
                axis2.GetViewMaximum();
                axis.GetViewMinimum();
                axis.GetViewMaximum();
                bool   flag2    = true;
                double interval = 1.0;
                if (!flag)
                {
                    interval = ((ChartAreaAxes)chartArea).GetPointsInterval(seriesNamesList, axis2.Logarithmic, axis2.logarithmBase, true, out flag2);
                }
                double num3      = series.GetPointWidth(chartArea.Common.graph, axis2, interval, 0.8) / num;
                float  depth     = default(float);
                float  zPosition = default(float);
                this.GetSeriesZPositionAndDepth(series, out depth, out zPosition);
                int num4 = 0;
                foreach (DataPoint point in series.Points)
                {
                    num4++;
                    double xPosition;
                    double position;
                    if (flag)
                    {
                        xPosition = axis2.GetPosition((double)num4) - num3 * num / 2.0 + num3 / 2.0 + (double)num2 * num3;
                        position  = axis2.GetPosition((double)num4);
                    }
                    else if (flag2)
                    {
                        xPosition = axis2.GetPosition(point.XValue) - num3 * num / 2.0 + num3 / 2.0 + (double)num2 * num3;
                        position  = axis2.GetPosition(point.XValue);
                    }
                    else
                    {
                        xPosition = axis2.GetPosition(point.XValue);
                        position  = axis2.GetPosition(point.XValue);
                    }
                    DataPoint3D dataPoint3D = new DataPoint3D();
                    dataPoint3D.indexedSeries = flag;
                    dataPoint3D.dataPoint     = point;
                    dataPoint3D.index         = num4;
                    dataPoint3D.xPosition     = xPosition;
                    dataPoint3D.xCenterVal    = position;
                    dataPoint3D.width         = series.GetPointWidth(chartArea.Common.graph, axis2, interval, 0.8) / num;
                    dataPoint3D.depth         = depth;
                    dataPoint3D.zPosition     = zPosition;
                    double yValue = chartType.GetYValue(base.Common, chartArea, series, point, num4 - 1, mainYValueIndex);
                    dataPoint3D.yPosition = axis.GetPosition(yValue);
                    dataPoint3D.height    = axis.GetPosition(yValue - chartType.GetYValue(base.Common, chartArea, series, point, num4 - 1, -1));
                    arrayList.Add(dataPoint3D);
                }
                if (num > 1.0 && sideBySide)
                {
                    num2++;
                }
            }
            if (comparer == null)
            {
                comparer = new PointsDrawingOrderComparer((ChartArea)this, selection, coord);
            }
            arrayList.Sort(comparer);
            return(arrayList);
        }