@Override
	public Intersection getIntersection(Ray ray) {

		Vector distance = Vector.minus(this.position, ray.origin);
		double b = Vector.dot(ray.direction, distance);
		double d = b * b - Vector.dot(distance, distance) + this.radius * this.radius;

		if (d < 0.0d)
			return null;

		// calculate both solutions
		double t = 0;
		double t0 = b - Math.sqrt(d);
		double t1 = b + Math.sqrt(d);

		// find smallest positive t
		if (t0 > 0)
			t = t0;
		if (t1 > 0 && t1 < t0)
			t = t1;

		// return intersection
		if (t > 0) {
			Vector position = ray.solve(t);
			Vector normal = Vector.minus(position, this.position).normalize();
			return new Intersection(this, t, position, normal);
		}

		return null;
	}