// 3 / 17 / 04 Forrest Briggs
// A part of each octree node. Handles intersection functions. 
  
#ifndef cboundingbox_h
#define cboundingbox_h

#include "ForwardDeclarations.h"
#include "cVector.h"
#include "cTriangle.h"
#include "cColor.h"
#include <vector>

class cBoundingBox
{
public:
    // just to make the compiler happy, doesnt do anything
    cBoundingBox();

    // copy constructor
    cBoundingBox(const cBoundingBox& toCopy);
    
    cBoundingBox(float xmin, float xmax, float  ymin, float ymax, float zmin, float zmax);
    
    // return true if a point is in me
    bool pointIsInMe(cVector &point);
    
    // returns true if ALL of points are in me
    bool pointsAreInMe(vector<cVector>& points); 
    
    // returns true in ANY of points are in me
    bool anyPointIsInMe(vector<cVector>& points); 
    
    bool boxIntersectsMe(cBoundingBox &otherBox);
    
    void getMyVertices(vector<cVector>& vertices); // fills vertices with the vertices of this box 
    
    // a wrapper for Tomas Akenine-Möller's crazy fast test
    bool triangleIntersects(cTriangle& triangle);                            
    
    // draw the bounding box, for debugging purposes
    void draw();				
    
    float xmin_, xmax_, ymin_, ymax_, zmin_, zmax_;
};

#endif