//=========================================================================== // GoTools Core - SINTEF Geometry Tools Core library, version 2.0.1 // // Copyright (C) 2000-2007, 2010 SINTEF ICT, Applied Mathematics, Norway. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // Contact information: E-mail: tor.dokken@sintef.no // SINTEF ICT, Department of Applied Mathematics, // P.O. Box 124 Blindern, // 0314 Oslo, Norway. // // Other licenses are also available for this software, notably licenses // for: // - Building commercial software. // - Building software whose source code you wish to keep private. //=========================================================================== 00015 #ifndef _RECTDOMAIN_H 00016 #define _RECTDOMAIN_H 00017 00018 #include "GoTools/utils/Array.h" 00019 #include "GoTools/geometry/Domain.h" 00020 #include "GoTools/utils/config.h" 00021 00022 namespace Go 00023 { 00024 00029 class GO_API RectDomain : public Domain 00030 { 00031 public: 00033 RectDomain() {} 00034 00039 RectDomain(const Array<double, 2>& corner1, 00040 const Array<double, 2>& corner2); 00041 00043 virtual ~RectDomain(); 00044 00045 // check whether a given parameter pair is located inside the domain. 00046 // DOXYGEN documentation can be found in the base class header Domain.h 00047 virtual bool isInDomain(const Array<double, 2>& point, 00048 double tolerance) const; 00049 00050 // check whether a gien parameter pair is located on the Domain boundary. 00051 // DOXYGEN documentation can be found in the base class header Domain.h 00052 virtual bool isOnBoundary(const Array<double, 2>& point, 00053 double tolerance) const; 00054 00055 bool isOnCorner(const Array<double, 2>& point, 00056 double tolerance) const; 00057 00058 int whichBoundary(const Array<double, 2>& point1, const Array<double, 2>& point2, 00059 double tolerance) const; 00060 00064 // DOXYGEN documentation can be found in the base class header Domain.h 00065 virtual void closestInDomain(const Array<double, 2>& point, 00066 Array<double, 2>& clo_pt, 00067 double tolerance) const; 00068 00073 // DOXYGEN documentation can be found in the base class header Domain.h 00074 virtual void closestOnBoundary(const Array<double, 2>& point, 00075 Array<double, 2>& clo_bd_pt, 00076 double tolerance) const; 00077 00080 void addUnionWith(const RectDomain& rd); 00081 00085 void intersectWith(const RectDomain& rd); 00086 00089 double umin() const { return ll_[0]; } 00090 00093 double umax() const { return ur_[0]; } 00094 00097 double vmin() const { return ll_[1]; } 00098 00101 double vmax() const { return ur_[1]; } 00102 00105 Array<double, 2> lowerLeft() const { return ll_; } 00106 00109 Array<double, 2> upperRight() const { return ur_; } 00110 00111 private: 00112 // We store the lower left and upper right points 00113 Array<double, 2> ll_; 00114 Array<double, 2> ur_; 00115 }; 00116 00117 00118 } // namespace Go 00119 00120 #endif // _RECTDOMAIN_H 00121