-
Notifications
You must be signed in to change notification settings - Fork 0
/
sphere.hpp
34 lines (27 loc) · 678 Bytes
/
sphere.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef SPHERE_HPP
#define SPHERE_HPP
#include "hittable.hpp"
#include "ray.hpp"
#include "common.hpp"
#include <memory>
using strangeloop::Hittable;
using strangeloop::HitRecord;
using strangeloop::Point;
using strangeloop::Ray;
namespace strangeloop {
class Sphere : public Hittable
{
public:
Sphere();
Sphere(Point center, double r);
Sphere(Point center, double r, std::shared_ptr<Material> m);
virtual bool hit(const Ray& r, double tMin, double tMax, HitRecord& rec) const override;
Point center() const;
double radius() const;
private:
Point _center;
double _radius;
std::shared_ptr<Material> _material;
};
}
#endif // SPHERE_HPP