diff options
Diffstat (limited to 'Build/source/utils/asymptote/bbox.h')
-rw-r--r-- | Build/source/utils/asymptote/bbox.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Build/source/utils/asymptote/bbox.h b/Build/source/utils/asymptote/bbox.h index dcb4d98b758..3edbe45d7e2 100644 --- a/Build/source/utils/asymptote/bbox.h +++ b/Build/source/utils/asymptote/bbox.h @@ -19,7 +19,7 @@ inline T min(T a, T b) return (a < b) ? a : b; } -template<class T> +template<class T> inline T max(T a, T b) { return (a > b) ? a : b; @@ -32,7 +32,7 @@ struct bbox { double bottom; double right; double top; - + // Start bbox about the origin bbox() : empty(true), left(0.0), bottom(0.0), right(0.0), top(0.0) @@ -54,7 +54,7 @@ struct bbox { bool nonempty() const { return !empty; } - + // Add a point to a bbox bbox add(const pair& z) { @@ -67,9 +67,9 @@ struct bbox { } else { if (x < left) - left = x; + left = x; else if (x > right) - right = x; + right = x; if (y < bottom) bottom = y; else if (y > top) @@ -84,9 +84,9 @@ struct bbox { { double x = z.getx(), y = z.gety(); if (x < left) - left = x; + left = x; else if (x > right) - right = x; + right = x; if (y < bottom) bottom = y; else if (y > top) @@ -99,11 +99,11 @@ struct bbox { double x = z.getx(), y = z.gety(); if (x < left) { - left = x; + left = x; times.left = t; } else if (x > right) { - right = x; + right = x; times.right = t; } if (y < bottom) { @@ -170,34 +170,34 @@ struct bbox { right = min(right, b.right); bottom = max(bottom, b.bottom); top = min(top, b.top); - if(left > right || bottom > top) + if(left > right || bottom > top) *this=bbox(); } - + void shift(const pair& p) { left += p.getx(); right += p.getx(); bottom += p.gety(); top += p.gety(); } - + pair Min() const { return pair(left,bottom); } - + pair Max() const { return pair(right,top); } - + double diameter() { return (Max()-Min()).length(); } - + bbox LowRes() const { return bbox(floor(left),floor(bottom),ceil(right),ceil(top)); } - + friend ostream& operator<< (ostream& out, const bbox& b) { out << b.left << " " << b.bottom << " " << b.right << " " << b.top; |