Function that calculates the integral of the line between two
x-coordinates, given the slope and intercept of the line.
@param x0
@param x1
@param slope
@param intercept
@returns {number} integral value.
421658
function integral(x0, x1, slope, intercept) {
                return (0.5 * slope * x1 * x1 + intercept * x1) - (0.5 * slope * x0 * x0 + intercept * x0);
            }
894078
public void flipX(double x0, double x1) {
		xx = -xx;
		xy = -xy;
		xd = x0 + x1 - xd;
	}
1056168
private static void drawLine(int x0, int y0, int x1, int y1, boolean[][] pic) {
    final int xres = pic.length, yres = pic[0].length;
    // Ensure bounds
    y0 = (y0 < 0) ? 0 : (y0 >= yres) ? (yres - 1) : y0;
    y1 = (y1 < 0) ? 0 : (y1 >= yres) ? (yres - 1) : y1;
    x0 = (x0 < 0) ? 0 : (x0 >= xres) ? (xres - 1) : x0;
    x1 = (x1 < 0) ? 0 : (x1 >= xres) ? (xres - 1) : x1;
    // Default slope
    final int dx = +Math.abs(x1 - x0), sx = x0 < x1 ? 1 : -1;
    final int dy = -Math.abs(y1 - y0), sy = y0 < y1 ? 1 : -1;
    // Error counter
    int err = dx + dy;

    for(;;) {
      pic[x0][y0] = true;
      if(x0 == x1 && y0 == y1) {
        break;
      }

      final int e2 = err << 1;
      if(e2 > dy) {
        err += dy;
        x0 += sx;
      }
      if(e2 < dx) {
        err += dx;
        y0 += sy;
      }
    }
  }
359046
public double curvePoint(XYZ vec, float t) {
        double tmp = 0;
        switch (vec) {
        case X:
            tmp = catmullRom(points[0], points[3], points[6], points[9], t);
            break;
        case Y:
            tmp = catmullRom(points[1], points[4], points[7], points[10], t);
            break;
        default:
            break;
        }
        return tmp;
    }
13174
public double get(int x, int y) {
    return (x == y) ? 0 : (x < y) //
        ? matrix[MatrixParadigm.triangleSize(y) + x] //
        : matrix[MatrixParadigm.triangleSize(x) + y];
  }
1141419
public static double quadratic2( double g0 , double x0 , double g1  , double x1 ) {

		return x0 + (g0/(g0-g1))*(x1-x0);
	}
580145
public static function int_add($x, $y)
    {
        if ($y == 0) {
            return $x;
        } else {
            return self::int_add($x ^ $y, ($x & $y) << 1);
        }
    }
877740
function pointFpMultiplyTwo(j,x,k) {
  var i;
  if(j.bitLength() > k.bitLength())
    i = j.bitLength() - 1;
  else
    i = k.bitLength() - 1;

  var R = this.curve.getInfinity();
  var both = this.add(x);
  while(i >= 0) {
    R = R.twice();
    if(j.testBit(i)) {
      if(k.testBit(i)) {
        R = R.add(both);
      }
      else {
        R = R.add(this);
      }
    }
    else {
      if(k.testBit(i)) {
        R = R.add(x);
      }
    }
    --i;
  }

  return R;
}
95887
public boolean process(PairLineNorm line0, PairLineNorm line1) {

		// Find plane equations of second lines in the first view
		double a0 = GeometryMath_F64.dot(e2,line0.l2);
		double a1 = GeometryMath_F64.dot(e2,line1.l2);

		GeometryMath_F64.multTran(A,line0.l2,Al0);
		GeometryMath_F64.multTran(A,line1.l2,Al1);

		// find the intersection of the planes created by each view of each line
		// first line
		planeA.set( line0.l1.x , line0.l1.y , line0.l1.z , 0 );
		planeB.set( Al0.x , Al0.y , Al0.z , a0 );

		if( !Intersection3D_F64.intersect(planeA,planeB,intersect0) )
			return false;
		intersect0.slope.normalize(); // maybe this will reduce overflow problems?

		// second line
		planeA.set( line1.l1.x , line1.l1.y , line1.l1.z , 0 );
		planeB.set( Al1.x , Al1.y , Al1.z , a1 );

		if( !Intersection3D_F64.intersect(planeA,planeB,intersect1) )
			return false;

		intersect1.slope.normalize();

		// compute the plane defined by these two lines
		from0to1.x = intersect1.p.x - intersect0.p.x;
		from0to1.y = intersect1.p.y - intersect0.p.y;
		from0to1.z = intersect1.p.z - intersect0.p.z;

		// the plane's normal will be the cross product of one of the slopes and a line connecting the two lines
		GeometryMath_F64.cross(intersect0.slope,from0to1,pi.n);
		pi.p.set(intersect0.p);

		// convert this plane description into general format
		UtilPlane3D_F64.convert(pi,pi_gen);

		v.set(pi_gen.A/pi_gen.D,pi_gen.B/pi_gen.D,pi_gen.C/pi_gen.D);

		// H = A - e2*v^T
		GeometryMath_F64.outerProd(e2,v,av);
		CommonOps_DDRM.subtract(A, av, H);

		// pick a good scale and sign for H
		adjust.adjust(H, line0);

		return true;
	}
1069258
public static int distanceSq (int x0, int y0, int x1, int y1)
    {
        return ((x1 - x0) * (x1 - x0)) + ((y1 - y0) * (y1 - y0));
    }
210181
public static boolean lineIntersectsRect (double x1, double y1, double x2, double y2,
                                              double rx, double ry, double rw, double rh) {
        double rr = rx + rw, rb = ry + rh;
        return (rx <= x1 && x1 <= rr && ry <= y1 && y1 <= rb)
            || (rx <= x2 && x2 <= rr && ry <= y2 && y2 <= rb)
            || linesIntersect(rx, ry, rr, rb, x1, y1, x2, y2)
            || linesIntersect(rr, ry, rx, rb, x1, y1, x2, y2);
    }
184228
public double Function1D(double x) {
        return Math.exp(x * x / (-2 * sqrSigma)) / (Math.sqrt(2 * Math.PI) * sigma);
    }
355853
public static double Y(double x) {
        if (x < 8.0) {
            double y = x * x;
            double ans1 = x * (-0.4900604943e13 + y * (0.1275274390e13
                    + y * (-0.5153438139e11 + y * (0.7349264551e9
                    + y * (-0.4237922726e7 + y * 0.8511937935e4)))));
            double ans2 = 0.2499580570e14 + y * (0.4244419664e12
                    + y * (0.3733650367e10 + y * (0.2245904002e8
                    + y * (0.1020426050e6 + y * (0.3549632885e3 + y)))));
            return (ans1 / ans2) + 0.636619772 * (J(x) * Math.log(x) - 1.0 / x);
        } else {
            double z = 8.0 / x;
            double y = z * z;
            double xx = x - 2.356194491;
            double ans1 = 1.0 + y * (0.183105e-2 + y * (-0.3516396496e-4
                    + y * (0.2457520174e-5 + y * (-0.240337019e-6))));
            double ans2 = 0.04687499995 + y * (-0.2002690873e-3
                    + y * (0.8449199096e-5 + y * (-0.88228987e-6
                    + y * 0.105787412e-6)));
            return Math.sqrt(0.636619772 / x) *
                    (Math.sin(xx) * ans1 + z * Math.cos(xx) * ans2);
        }
    }
375090
public static double distanceFromLine(double x0, double y0, double x1, double y1, double x2, double y2)
    {
        double dx = x2-x1;
        if (dx == 0.0)
        {
            return Math.abs(x1-x0);
        }
        double dy = y2-y1;
        if (dy == 0.0)
        {
            return Math.abs(y1-y0);
        }
        return Math.abs(dy*x0-dx*y0+x2*y1-y2*x1)/Math.hypot(dx, dy);
    }
847175
function(start, end, point) {
        if (point <= start) {
            return 0;
        }
        if (point >= end) {
            return 1;
        }
        let x = (point - start) / (end - start); // interpolation
        return x * x * (3 - 2 * x);
    }
1217742
public static double log1p(final double x) {
        if (x == -1) {
            return Double.NEGATIVE_INFINITY;
        }

        if (x == Double.POSITIVE_INFINITY) {
            return Double.POSITIVE_INFINITY;
        }

        if (x > 1e-6 ||
            x < -1e-6) {
            final double xpa = 1 + x;
            final double xpb = -(xpa - 1 - x);

            final double[] hiPrec = new double[2];
            final double lores = log(xpa, hiPrec);
            if (Double.isInfinite(lores)) { // Don't allow this to be converted to NaN
                return lores;
            }

            // Do a taylor series expansion around xpa:
            //   f(x+y) = f(x) + f'(x) y + f''(x)/2 y^2
            final double fx1 = xpb / xpa;
            final double epsilon = 0.5 * fx1 + 1;
            return epsilon * fx1 + hiPrec[1] + hiPrec[0];
        } else {
            // Value is small |x| < 1e6, do a Taylor series centered on 1.
            final double y = (x * F_1_3 - F_1_2) * x + 1;
            return y * x;
        }
    }
412286
function (f, x) {
        var integral = function (a, b) {
            var tenx = Math.pow(10, x),
                sum = 0,
                i;

            for (i = a + (1 / tenx); i < b; i += 1 / tenx) {
                sum += f(i) / tenx;
            }

            return Math.round(sum * tenx / 10) / (tenx / 10);
        };

        integral.from = integral;
        return integral;
    }