Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

xyzbounding.h

00001 /***************************************************************************
00002                           xyzbounding.h  -  description
00003                              -------------------
00004     begin                : Sun Aug 24 2003
00005     copyright            : (C) 2003 by Jacques Gasselin de Richebourg
00006     email                : jacquesgasselin@hotmail.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU Lesser General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA *
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       //upper > lower
00056       //lower < upper
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

Generated on Wed Feb 4 23:11:34 2004 by doxygen 1.3.3