-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sphere.h
44 lines (34 loc) · 840 Bytes
/
Sphere.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
41
42
43
44
/*----------------------------------------------------------
* COSC363 Ray Tracer
*
* The sphere class
* This is a subclass of Object, and hence implements the
* methods intersect() and normal().
-------------------------------------------------------------*/
#ifndef H_SPHERE
#define H_SPHERE
#include "Object.h"
/**
* Defines a simple Sphere located at 'center'
* with the specified radius
*/
class Sphere : public Object
{
private:
Vector center;
float radius;
public:
Sphere()
: center(Vector()), radius(1) //Default constructor creates a unit sphere
{
color = Color::WHITE;
};
Sphere(Vector c, float r, Color col)
: center(c), radius(r)
{
color = col;
};
float intersect(Vector pos, Vector dir);
Vector normal(Vector p);
};
#endif //!H_SPHERE