An Example Renderable Object

// An example "Renderable" object

class Sphere implements Renderable {
    Surface surface;
    Vector3D center;
    float radius;
    private float radSqr;

    public Sphere(Surface s, Vector3D c, float r) {
        surface = s;
        center = c;
        radius = r;
        radSqr = r*r; //precompute this because we'll use it a lot
    }
	
    public String toString() {
        return ("sphere "+center+" "+radius);
    }
Lecture 19   Slide 16   6.837 Fall '00