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 __OBJECT_SPHERE_H__
|
|
|
|
#define __OBJECT_SPHERE_H__
|
|
|
|
|
|
|
|
#include "basics.h"
|
|
|
|
#include "object.h"
|
|
|
|
|
|
|
|
|
|
|
|
class Sphere
|
|
|
|
: public Shape
|
|
|
|
{
|
2013-09-10 21:04:31 -07:00
|
|
|
public:
|
2013-09-10 09:34:15 -07:00
|
|
|
Sphere();
|
|
|
|
Sphere(float r);
|
|
|
|
Sphere(Vector3 o, float r);
|
|
|
|
|
|
|
|
float get_radius();
|
|
|
|
void set_radius(float r);
|
|
|
|
|
2013-09-10 21:04:31 -07:00
|
|
|
int does_intersect(const Ray &ray, float **t) const;
|
2013-09-10 22:32:33 -07:00
|
|
|
bool point_is_on_surface(const Vector3 &p) const;
|
2013-09-10 21:04:31 -07:00
|
|
|
Vector3 compute_normal(const Vector3 &p) const;
|
2013-09-10 09:34:15 -07:00
|
|
|
private:
|
|
|
|
float radius;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|