ICT290 / src / ShaysWorld / AABB.CPP
AABB.CPP
Raw
//  AABB.cpp
//
//  Implementation file for AABB Class
//  Defines all the methods declared, but not defined, in AABB.h
//
//  Shay Leary, March 2005
//--------------------------------------------------------------------------------------

#include <iostream>
#include "AABB.H"

//--------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------
//  Set Methods
//----------------------------------------------------------------------------------
void AABB::SetMaxX(const int& tempIndex,

                   const GLdouble& tempX) {
    m_BBox[tempIndex].max.x = tempX;
}
void AABB::SetMinX(const int& tempIndex, const GLdouble& tempX) {
    m_BBox[tempIndex].min.x = tempX;
}
void AABB::SetMaxY(const int& tempIndex, const GLdouble& tempY) {
    m_BBox[tempIndex].max.y = tempY;
}
void AABB::SetMinY(const int& tempIndex, const GLdouble& tempY) {
    m_BBox[tempIndex].min.y = tempY;
}
void AABB::SetMaxZ(const int& tempIndex, const GLdouble& tempZ) {
    m_BBox[tempIndex].max.z = tempZ;
}
void AABB::SetMinZ(const int& tempIndex, const GLdouble& tempZ) {
    m_BBox[tempIndex].min.z = tempZ;
}
void AABB::AddBoundingBox(){
    m_BBox.emplace_back();
}

//----------------------------------------------------------------------------------
//  Get Methods
//----------------------------------------------------------------------------------
GLdouble AABB::GetMaxX(const int& tempIndex) const { return m_BBox[tempIndex].max.x; }
GLdouble AABB::GetMinX(const int& tempIndex) const { return m_BBox[tempIndex].min.x; }
GLdouble AABB::GetMaxY(const int& tempIndex) const { return m_BBox[tempIndex].max.y; }
GLdouble AABB::GetMinY(const int& tempIndex) const { return m_BBox[tempIndex].min.y; }
GLdouble AABB::GetMaxZ(const int& tempIndex) const { return m_BBox[tempIndex].max.z; }
GLdouble AABB::GetMinZ(const int& tempIndex) const { return m_BBox[tempIndex].min.z; }
size_t AABB::GetNoBoundingBoxes() const { return m_BBox.size(); }

void AABB::clear() {
    m_BBox.clear();
}