-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObject.h
42 lines (34 loc) · 863 Bytes
/
Object.h
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
35
36
37
38
39
40
#include <vector>
#include <cstdlib>
#include "Material.h"
using namespace std;
// A superclass that represents geometric objects.
// You can extend/modify the class to add support for textured objects.
class Object {
protected:
Material * m;
bool isLight;
public:
Material * getMaterial(){return m;}
void setMaterial(Material *);
bool isLightSource(){ return isLight; }
virtual Point getIntersection(Ray) = 0;
virtual Point getNormal(Point) = 0;
};
// A triangle object
class Triangle : public Object {
public:
Point p1,p2,p3,n;
Point getIntersection(Ray);
Point getNormal(Point);
Triangle(Point, Point, Point, Point);
};
// A sphere object
class Sphere : public Object {
Point center;
double radius;
public:
Point getNormal(Point);
Point getIntersection(Ray);
Sphere(Point,double);
};