charles/src/objectSphere.hh

40 lines
777 B
C++
Raw Normal View History

2013-09-10 09:34:15 -07:00
/* object_sphere.h
*
* Spheres are Shapes defined by a center point and a radius.
*
* Eryn Wells <eryn@erynwells.me>
*/
#ifndef __OBJECTSPHERE_HH__
#define __OBJECTSPHERE_HH__
2013-09-10 09:34:15 -07:00
2014-08-09 11:04:17 -07:00
#include "object.hh"
#include "basics/basics.hh"
2013-09-10 09:34:15 -07:00
namespace charles {
2013-09-10 09:34:15 -07:00
class Sphere
: public Object
2013-09-10 09:34:15 -07:00
{
public:
Sphere(const basics::Vector4& origin = basics::Vector4(), Double radius = 1.0);
2013-09-10 09:34:15 -07:00
Double GetRadius() const;
2014-08-09 11:04:17 -07:00
void SetRadius(const Double& r);
/** @see charles::Object::Write */
void Write(std::ostream& ost) const;
2014-08-09 11:04:17 -07:00
protected:
bool DoIntersect(const basics::Ray& ray, TVector& t, Stats& stats) const;
basics::Vector4 DoNormal(const basics::Vector4& p) const;
2013-09-10 09:34:15 -07:00
private:
Double mRadius;
2013-09-10 09:34:15 -07:00
};
} /* namespace charles */
#endif /* __OBJECTSPHERE_HH__ */