Back to index

salome-med  6.5.0
BoundingBox.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __BOUNDINGBOX_HXX__
00021 #define __BOUNDINGBOX_HXX__
00022 
00023 #include "INTERPKERNELDefines.hxx"
00024 #include <iostream>
00025 
00026 namespace INTERP_KERNEL
00027 {
00028 
00033   class INTERPKERNEL_EXPORT BoundingBox 
00034   {
00035   public:
00036 
00038     enum BoxCoord { XMIN = 0, YMIN = 1, ZMIN = 2, XMAX = 3, YMAX = 4, ZMAX = 5 };
00039         
00040     BoundingBox(const double** pts, const unsigned numPts);
00041 
00042     BoundingBox(const BoundingBox& box1, const BoundingBox& box2);
00043 
00044     ~BoundingBox();
00045 
00046     bool isDisjointWith(const BoundingBox& box) const;
00047     
00048     inline void setCoordinate(const BoxCoord coord, double value);
00049 
00050     inline double getCoordinate(const BoxCoord coord) const;
00051 
00052     void updateWithPoint(const double* pt);
00053 
00054     inline void dumpCoords() const;
00055 
00056   private:
00057     
00058     bool isValid() const;
00059 
00061     BoundingBox(const BoundingBox& box);
00062     
00064     BoundingBox& operator=(const BoundingBox& box);
00065     
00068     double* _coords;
00069 
00070   };
00071 
00079   inline void BoundingBox::setCoordinate(const BoxCoord coord, double value)
00080   {
00081     _coords[coord] = value;
00082   }
00083 
00091   inline double BoundingBox::getCoordinate(const BoxCoord coord) const
00092   {
00093     return _coords[coord];
00094   }
00095 
00100   inline void BoundingBox::dumpCoords() const
00101   {
00102     std::cout << "[xmin, xmax] = [" << _coords[XMIN] << ", " << _coords[XMAX] << "]" << " | ";
00103     std::cout << "[ymin, ymax] = [" << _coords[YMIN] << ", " << _coords[YMAX] << "]" << " | ";
00104     std::cout << "[zmin, zmax] = [" << _coords[ZMIN] << ", " << _coords[ZMAX] << "]";
00105     std::cout << std::endl;
00106   }
00107 
00108 }
00109 
00110 #endif