Version: 6.3.1

src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  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 __INTERPKERNELGEO2DBOUNDS_HXX__
00021 #define __INTERPKERNELGEO2DBOUNDS_HXX__
00022 
00023 #include "INTERPKERNELGEOMETRIC2DDefines.hxx"
00024 
00025 #include <algorithm>
00026 
00027 namespace INTERP_KERNEL
00028 {
00032   typedef enum
00033     {
00034       IN              = 0,
00035       OUT             = 1,
00036       ON_BOUNDARY_POS = 2,
00037       ON_BOUNDARY_NEG = 3
00038     } Position;
00039   
00040   class INTERPKERNELGEOMETRIC2D_EXPORT Bounds
00041   {
00042   public:
00043     Bounds():_x_min(0.),_x_max(0.),_y_min(0.),_y_max(0.) { }
00044     double &operator[](int i);
00045     const double& operator[](int i) const;
00046     double getDiagonal() const;
00047     void getBarycenter(double& xBary, double& yBary) const;
00048     void applySimilarity(double xBary, double yBary, double dimChar);
00049     Bounds& operator=(const Bounds& other) { _x_min=other._x_min; _x_max=other._x_max; _y_min=other._y_min; _y_max=other._y_max; return *this; }
00050     Bounds(double xMin, double xMax, double yMin, double yMax):_x_min(xMin),_x_max(xMax),_y_min(yMin),_y_max(yMax) { }
00051     void setValues(double xMin, double xMax, double yMin, double yMax) { _x_min=xMin; _x_max=xMax; _y_min=yMin; _y_max=yMax; }
00052     void prepareForAggregation();
00053     void getInterceptedArc(const double *center, double radius, double& intrcptArcAngle0, double& intrcptArcDelta) const;
00054     int fitXForXFig(double val, int res) const { return (int)fitXForXFigD(val,res); }
00055     int fitYForXFig(double val, int res) const { return (int)fitYForXFigD(val,res); }
00056     double fitXForXFigD(double val, int res) const;
00057     double fitYForXFigD(double val, int res) const;
00058     Bounds *nearlyAmIIntersectingWith(const Bounds& other) const;
00059     Bounds *amIIntersectingWith(const Bounds& other) const;
00061     Position where(double x, double y) const;
00063     Position nearlyWhere(double x, double y) const;
00064     void aggregate(const Bounds& other);
00065     double getCaracteristicDim() const { return std::max(_x_max-_x_min,_y_max-_y_min); }
00066   protected:
00067     double _x_min;
00068     double _x_max;
00069     double _y_min;
00070     double _y_max;
00071   };
00072 }
00073 
00074 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS