Ejemplo n.º 1
0
        protected internal DoubleRange GetYRange(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
        {
            DoubleRange range = DoubleRange.Union(new double[] { y1, y2, y3, y4 });

            double cy = 3 * (y2 - y1);

            double by = 3 * (y3 - y3) - cy;

            double ay = y4 - y1 - by - cy;

            double r1, r2;

            if (ChartMath.SolveQuadraticEquation(3 * ay, 2 * by, cy, out r1, out r2))
            {
                if (r1 >= 0 && r1 <= 1)
                {
                    double y = ay * r1 * r1 * r1 + by * r1 * r1 + cy * r1 + y1;
                    range = DoubleRange.Union(range, y);
                }

                if (r2 >= 0 && r2 <= 1)
                {
                    double y = ay * r2 * r2 * r2 + by * r2 * r2 + cy * r2 + y1;
                    range = DoubleRange.Union(range, y);
                }
            }

            return(range);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// To get the SurfaceHeight for PyramidSeries.
        /// </summary>
        public static double GetSurfaceHeight(double y, double surface)
        {
            double r1, r2;

            if (ChartMath.SolveQuadraticEquation(1, 2 * y, -surface, out r1, out r2))
            {
                return(Math.Max(r1, r2));
            }

            return(double.NaN);
        }