/************************************************************************************************
 *                                                                                              *
 * Sphere Geometry object: specified by center and radius                                       *
 *                                                                                              *
 *                                          XianMing Chen, Jan 7, 2002                          *
 ************************************************************************************************/


#ifndef _SPHERE_H_
#define _SPHERE_H_

#include "Ray.h"


class Sphere {
 public:
    Sphere():r(1.0) { col[0] = 1; }
    ~Sphere() {}

    Vector & center() { return cnt; }
    const Vector & center() const { return cnt; }
    Vector & center(const Vector& p) { return cnt=p; }

    RGBcolor & color() { return col; }
    const RGBcolor & color() const { return col; }
    RGBcolor & color(const RGBcolor& c) { return col=c; }

    
    double& radius() { return r; }
    const double & radius() const { return r; }
    double & radius(double d) { return r=d; }

    bool intersected(Ray& ray); //change ray parameter t to intersected point.

    friend ostream& operator<< (ostream& os, const Sphere& sphere);
 private:
    Vector cnt;
    RGBcolor col;
    double r;
};




#endif

