最小外包矩形MBR就是包围图元,且平行于X,Y轴的最小外接矩形。
template<class T>
struct CGeoRect
{
// Four corner points
T m_minX;
T m_minY;
T m_maxX;
T m_maxY;
//
// Constructors and deconstructor
//
/**
* Default constructor with no any sense.
*
* Note:
* 1) If passed by self-defined data type, it must have copy constructor being responsible for
* converting doulbe to it.
* 2) Since we adopt UEZERO as invalid point which makes sense when not initialized before being used,
* we had better notice the assertion happen before correctly using one geometry.
*/
CGeoRect() : m_minX(-1.), m_minY(-1.), m_maxX(-1.), m_maxY(-1.)
{
}
/**
* Default constructor with specified corner values.
*/
CGeoRect(const T &minX, const T &minY, const T &maxX, const T& maxY) : m_minX(minX),
m_minY(minY), m_maxX(maxX), m_maxY(maxY)
{
}
/**
* Copy constructor.
*
* Note: If passed by self-defined data type, it must overload assignment operator
*/
CGeoRect(const CGeoRect &other)
{
m_minX = other.m_minX;
m_maxY = other.m_maxY;
m_maxX = other.m_maxX;
m_minY = other.m_minY;