#ifndef SPHERE_H #define SPHERE_H #include "entity.h" class Sphere : public Entity { public: Sphere(const vector3d¢er, double radius) {c = center; r = radius;} virtual ~Sphere() {} virtual RayIntersect CalcRayIntersect(Ray ray); virtual vector3d CalcNormal(Ray ray, RayIntersect& ri); virtual void PathCompress(const Transform&, queue >&, vector&); virtual int IntersectionTest(Ray ray); private: vector3d c; double r; }; inline void Sphere::PathCompress(const Transform&T, queue >&Q, vector&V) { Sphere * sp = new Sphere(*this); sp->c = T * c; sp->r = r * pow(fabs(T.rot.Det()), 1.0/3.0); V.push_back(sp); } #endif