00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef XYZBOUNDING_H
00028 #define XYZBOUNDING_H
00029
00030
00034 #include <map>
00035 #include "glvector.h"
00036
00037 class XYZBounding
00038 {
00039 typedef float boundType;
00040 std::pair<boundType,boundType> xbound;
00041 std::pair<boundType,boundType> ybound;
00042 std::pair<boundType,boundType> zbound;
00043
00044 public:
00045 XYZBounding(GLVector toCentre, GLfloat w, GLfloat h, GLfloat l);
00046 XYZBounding(boundType xmax,boundType xmin,
00047 boundType ymax, boundType ymin,
00048 boundType zmax, boundType zmin);
00049 XYZBounding(const XYZBounding&);
00050
00051 ~XYZBounding(){};
00052
00053 inline bool intersection(const XYZBounding& bound)
00054 {
00055
00056
00057 if( xbound.first > bound.xbound.second
00058 &&
00059 xbound.second < bound.xbound.first
00060 &&
00061 ybound.first > bound.ybound.second
00062 &&
00063 ybound.second < bound.ybound.first
00064 &&
00065 zbound.first > bound.zbound.second
00066 &&
00067 zbound.second < bound.zbound.first
00068 ) return true;
00069 return false;
00070 }
00071
00072 inline bool intersectionX(const boundType& upper, const boundType& lower)
00073 {
00074 if( xbound.first > lower && xbound.second < upper)
00075 return true;
00076 return false;
00077 }
00078
00079 inline bool intersectionY(const boundType& upper, const boundType& lower)
00080 {
00081 if( ybound.first > lower && ybound.second < upper)
00082 return true;
00083 return false;
00084 }
00085
00086 inline bool intersectionZ(const boundType& upper, const boundType& lower)
00087 {
00088 if( zbound.first > lower && zbound.second < upper)
00089 return true;
00090 return false;
00091 }
00092 };
00093
00094 #endif