public double approxLength(Cubic[] curve) {
        double sum = 0;

        int N = curve.length;
        double[] old = new double[curve.length];
        for (double i = 0; i < 1; i += .1) {
            double s = 0;
            for (int j = 0; j < curve.length; j++) {
                double tmp = old[j];
                tmp -= old[j] = curve[j].eval(i);
                s += tmp * tmp;
            }
            if (i > 0) {
                sum += Math.sqrt(s);
            }

        }
        double s = 0;
        for (int j = 0; j < curve.length; j++) {
            double tmp = old[j];
            tmp -= old[j] = curve[j].eval(1);
            s += tmp * tmp;
        }
        sum += Math.sqrt(s);
        return sum;
    }
Spline in N dimensions

@param points [mPoints][dimensionality]
ConstraintLayoutExamples/CycleEditor/src/com/google/androidstudio/motionlayoutcycles/HyperSpline.java