Example #1
0
        public static double BezierQuartic(double t, double a, double b, double c, double d, double e)
        {
            var abcd = InterpolateBezierCubic1DTests.BezierCubic(t, a, b, c, d);
            var bcde = InterpolateBezierCubic1DTests.BezierCubic(t, b, c, d, e);

            return(InterpolateLinear1DTests.BezierLinear(t, abcd, bcde));
        }
        public static Point2D Envelope1(
            Point2D point,
            Rectangle2D bounds,
            Point2D topLeft, Point2D topLeftH, Point2D topLeftV,
            Point2D topRight, Point2D topRightH, Point2D topRightV,
            Point2D bottomRight, Point2D bottomRightH, Point2D bottomRightV,
            Point2D bottomLeft, Point2D bottomLeftH, Point2D bottomLeftV)
        {
            var norm   = NormalizeBoundedPoint2DTests.NormalizePoint(bounds, point);
            var left   = InterpolateBezierCubic1DTests.CubicBezier(norm.Y, topLeft.X, topLeftV.X, bottomLeftV.X, bottomLeft.X);
            var right  = InterpolateBezierCubic1DTests.CubicBezier(norm.Y, topRight.X, topRightV.X, bottomRightV.X, bottomRight.X);
            var top    = InterpolateBezierCubic1DTests.CubicBezier(norm.X, topLeft.Y, topLeftH.Y, topRightH.Y, topRight.Y);
            var bottom = InterpolateBezierCubic1DTests.CubicBezier(norm.X, bottomLeft.Y, bottomLeftH.Y, bottomRightH.Y, bottomRight.Y);
            var x      = InterpolateLinear1DTests.LinearInterpolate1D(norm.X, left, right);
            var y      = InterpolateLinear1DTests.LinearInterpolate1D(norm.Y, top, bottom);

            return(new Point2D(x, y));
        }