public static boolean line_circle(double x0, double y0, double x1, double y1, double cx, double cy, double r){
		double f = (x1 - x0);
		double g = (y1 - y0);
		double fSQ = f*f;
		double gSQ = g*g;
		double fgSQ = fSQ + gSQ;
		double rSQ = r*r;

		double xc0 = cx - x0;
		double yc0 = cy - y0;
		double xc1 = cx - x1;
		double yc1 = cy - y1;


		boolean lineInside = xc0*xc0 + yc0*yc0 < rSQ && xc1*xc1 + yc1*yc1 < rSQ;

		double fygx = f*yc0 - g*xc0;
		double root = r*r*fgSQ - fygx*fygx;

		if(root > ACCY && !lineInside){
			double fxgy = f*xc0 + g*yc0;
			double t = fxgy / fgSQ;
			if(t >= 0 && t <= 1)
				return true;
			// Circle intersects with one end then return true
			if( (xc0*xc0 + yc0*yc0 < rSQ) || (xc1*xc1 + yc1*yc1 < rSQ) )
				return true;
		}
		return false;
	}