Esempio n. 1
0
        // Utilities

        private static double axisValue(PairedPoint point, Axis axis)
        {
            if (axis == Axis.X)
            {
                return(point.X);
            }
            else if (axis == Axis.Y1)
            {
                return(point.Y1);
            }
            else
            {
                return(point.Y2);
            }
        }
Esempio n. 2
0
        public static PairedPoint?min(PairedPoint[] points, Axis axis)
        {
            if (points.Length == 0)
            {
                return(null);
            }

            double      minValue = axisValue(points[0], axis);
            PairedPoint min      = points[0];

            foreach (var point in points)
            {
                if (minValue > axisValue(point, axis))
                {
                    minValue = axisValue(point, axis);
                    min      = point;
                }
            }

            return(min);
        }
Esempio n. 3
0
        public static PairedPoint?max(PairedPoint[] points, Axis axis)
        {
            if (points.Length == 0)
            {
                return(null);
            }

            double      maxValue = axisValue(points[0], axis);
            PairedPoint max      = points[0];

            foreach (var point in points)
            {
                if (maxValue < axisValue(point, axis))
                {
                    maxValue = axisValue(point, axis);
                    max      = point;
                }
            }

            return(max);
        }