Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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