-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAXISALIGNEDBOUNDINGBOX.H
45 lines (36 loc) · 1.21 KB
/
AXISALIGNEDBOUNDINGBOX.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
45
/*
* Author: Corey Auger (corey@coreyauger.com)
*
* AxisAlignedBoundingBox
*
*/
#ifndef AXISALIGNEDBOUNDINGBOX_H
#define AXISALIGNEDBOUNDINGBOX_H
#include <memory>
#include "Scalar.h"
#include "Point.h"
#include "Vector.h"
#include "Ray.h"
#include <GL/gl.h>
#include <GL/glu.h>
namespace Affine{
class AxisAlignedBoundingBox
{
private:
std::auto_ptr< Point > mMax; // the most positive x,y,z Point
std::auto_ptr< Point > mMin; // the most negative x,y,z point
public:
AxisAlignedBoundingBox(); // Create BoundingBox with default values
AxisAlignedBoundingBox( const AxisAlignedBoundingBox& inSource ); // copy constructor
virtual ~AxisAlignedBoundingBox() {}; // virtual destructor
void reset(); // reset the BoundingBox to Default values
void addPoint(const Point &p); // Check if this is MAX or MIN to be added to AxisAlignedBoundingBox
void addPoint(const Scalar &x, const Scalar &y, const Scalar &z);
bool rayIntersect( const Ray &r, Scalar &tnear, Scalar &tfar);
Scalar getLength();
bool inBox( Object &test );
void scale(const Scalar sx, const Scalar sy, const Scalar sz);
bool overlaps( const AxisAlignedBoundingBox &other );
};
} // end Affine namespace
#endif