36 #ifndef __SBNW_LAYOUT_BOX_H_ 
   37 #define __SBNW_LAYOUT_BOX_H_ 
   47 #include <graphfab/layout/point.h> 
   61             Box(
const Point& min, 
const Point& max)
 
   62                 : _min(min), _max(max) { AT(_min.x <= _max.x && _min.y <= _max.y, 
"Min/max mismatch"); }
 
   66                 : _min(x1,y1), _max(x2,y2) {
 
   67                     if(!(_min.x <= _max.x && _min.y <= _max.y)) {
 
   71                     AT(_min.x <= _max.x && _min.y <= _max.y, 
"Min/max mismatch");
 
   75             const Point& getMin()
 const { 
return _min; }
 
   76             Real getMinX()
 const { 
return getMin().x; }
 
   77             Real getMinY()
 const { 
return getMin().y; }
 
   79             void setMin(
const Point& p) { _min = p; }
 
   81             void setMinX(
const Real x) { _min.x = x; }
 
   82             void setMinY(
const Real y) { _min.y = y; }
 
   85             const Point& getMax()
 const { 
return _max; }
 
   86             Real getMaxX()
 const { 
return getMax().x; }
 
   87             Real getMaxY()
 const { 
return getMax().y; }
 
   89             void setMax(
const Point& p) { _max = p; }
 
   91             void setMaxX(
const Real x) { _max.x = x; }
 
   92             void setMaxY(
const Real y) { _max.y = y; }
 
   94             Point getCenter()
 const { 
return (getMax() + getMin())/2.; }
 
   96             Point getFirstQuadCorner()
  const { 
return getMax(); }
 
   97             Point getSecondQuadCorner()
 const { 
return Point(_min.x, _max.y); }
 
   98             Point getThirdQuadCorner()
  const { 
return getMin(); }
 
   99             Point getFourthQuadCorner()
 const { 
return Point(_max.x, _min.y); }
 
  102             Point getDiag()
 const { 
return getMax() - getMin(); }
 
  105             Real maxDim()
 const {
 
  106                 Real w = _max.x - _min.x;
 
  107                 Real h = _max.y - _min.y;
 
  112             Real minDim()
 const {
 
  113                 Real w = _max.x - _min.x;
 
  114                 Real h = _max.y - _min.y;
 
  118             Point getTopRightCorner()
 const { 
return Point(_max.x, _min.y); }
 
  120             Point getBottomLeftCorner()
 const { 
return Point(_min.x, _max.y); }
 
  123             Real width()
 const { 
return _max.x - _min.x; }
 
  126             void setWidth(
const Real w) { _max.x = _min.x+w; }
 
  129             Real height()
 const { 
return _max.y - _min.y; }
 
  132             void setHeight(
const Real w) { _max.y = _min.y+w; }
 
  136                 Real w = _max.x - _min.x;
 
  137                 Real h = _max.y - _min.y;
 
  142             bool canShrink(
const Real v)
 const {
 
  143                 if(_min.x + 2*v <= _max.x && _min.y+2*v <= _max.y)
 
  150             Box shrink(
const Real v)
 const {
 
  151                 return Box(_min+Point(v,v), _max-Point(v,v));
 
  155             void shrink_(
const Real v) {
 
  163             Box padded(
const Real v)
 const {
 
  164                 return Box(_min-Point(v,v), _max+Point(v,v));
 
  168             void expandx(
const Box& other) {
 
  169                 _min = Point::emin(_min, other._min);
 
  170                 _max = Point::emax(_max, other._max);
 
  173             void displace(
const Point& d) {
 
  178             void dump(std::ostream& o)
 const {
 
  179                 o << 
"[" << getMin() << 
", " << getMax() << 
"]";
 
  188     std::ostream& operator<< (std::ostream& os, 
const Box& b);
 
  191     std::pair<bool, Point> intersectBoxLine(
const Box& b, 
const Point& u, 
const Point& v);
 
SAGITTARIUS_REAL Real
Make Real visible to C. Consider letting Real lie in top namespace. 
Definition: SagittariusCommon.h:136
 
Definition: SagittariusCommon.cpp:38