Changeset 1391:5b46af577b23 in lemon-0.x
- Timestamp:
- 04/26/05 17:50:30 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1846
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/xy.h
r1359 r1391 68 68 T normSquare() const { 69 69 return x*x+y*y; 70 } ;70 } 71 71 72 72 ///Increments the left hand side by u … … 75 75 y += u.y; 76 76 return *this; 77 } ;77 } 78 78 79 79 ///Decrements the left hand side by u … … 82 82 y -= u.y; 83 83 return *this; 84 } ;84 } 85 85 86 86 ///Multiplying the left hand side with a scalar … … 89 89 y *= u; 90 90 return *this; 91 } ;91 } 92 92 93 93 ///Dividing the left hand side by a scalar … … 96 96 y /= u; 97 97 return *this; 98 } ;98 } 99 99 100 100 ///Returns the scalar product of two vectors 101 101 T operator *(const xy<T>& u) const { 102 102 return x*u.x+y*u.y; 103 } ;103 } 104 104 105 105 ///Returns the sum of two vectors … … 107 107 xy<T> b=*this; 108 108 return b+=u; 109 } ;109 } 110 110 111 111 ///Returns the neg of the vectors … … 114 114 b.x=-b.x; b.y=-b.y; 115 115 return b; 116 } ;116 } 117 117 118 118 ///Returns the difference of two vectors … … 120 120 xy<T> b=*this; 121 121 return b-=u; 122 } ;122 } 123 123 124 124 ///Returns a vector multiplied by a scalar … … 126 126 xy<T> b=*this; 127 127 return b*=u; 128 } ;128 } 129 129 130 130 ///Returns a vector divided by a scalar … … 132 132 xy<T> b=*this; 133 133 return b/=u; 134 } ;134 } 135 135 136 136 ///Testing equality 137 137 bool operator==(const xy<T> &u) const { 138 138 return (x==u.x) && (y==u.y); 139 } ;139 } 140 140 141 141 ///Testing inequality 142 142 bool operator!=(xy u) const { 143 143 return (x!=u.x) || (y!=u.y); 144 } ;144 } 145 145 146 146 }; … … 152 152 template<typename T> xy<T> operator*(const T &u,const xy<T> &x) { 153 153 return x*u; 154 } ;154 } 155 155 156 156 ///Read a plainvector from a stream … … 227 227 } 228 228 229 ///Makes the BoundingBox empty 230 void clear() { 231 _empty=1; 232 } 233 229 234 ///Gives back the bottom left corner (if the bounding box is empty, then the return value is not defined) 230 235 xy<T> bottomLeft() const { 231 236 return bottom_left; 232 } ;237 } 233 238 234 239 ///Gives back the top right corner (if the bounding box is empty, then the return value is not defined) 235 240 xy<T> topRight() const { 236 241 return top_right; 237 } ;242 } 238 243 239 244 ///Gives back the bottom right corner (if the bounding box is empty, then the return value is not defined) 240 245 xy<T> bottomRight() const { 241 246 return xy<T>(top_right.x,bottom_left.y); 242 } ;247 } 243 248 244 249 ///Gives back the top left corner (if the bounding box is empty, then the return value is not defined) 245 250 xy<T> topLeft() const { 246 251 return xy<T>(bottom_left.x,top_right.y); 247 } ;252 } 248 253 249 254 ///Gives back the bottom of the box (if the bounding box is empty, then the return value is not defined) 250 255 T bottom() const { 251 256 return bottom_left.y; 252 } ;257 } 253 258 254 259 ///Gives back the top of the box (if the bounding box is empty, then the return value is not defined) 255 260 T top() const { 256 261 return top_right.y; 257 } ;262 } 258 263 259 264 ///Gives back the left side of the box (if the bounding box is empty, then the return value is not defined) 260 265 T left() const { 261 266 return bottom_left.x; 262 } ;267 } 263 268 264 269 ///Gives back the right side of the box (if the bounding box is empty, then the return value is not defined) 265 270 T right() const { 266 271 return top_right.x; 267 } ;272 } 268 273 269 274 ///Gives back the height of the box (if the bounding box is empty, then the return value is not defined) 270 275 T height() const { 271 276 return top_right.y-bottom_left.y; 272 } ;277 } 273 278 274 279 ///Gives back the width of the box (if the bounding box is empty, then the return value is not defined) 275 280 T width() const { 276 281 return top_right.x-bottom_left.x; 277 } ;282 } 278 283 279 284 ///Checks whether a point is inside a bounding box … … 300 305 } 301 306 return *this; 302 } ;307 } 303 308 304 309 ///Sums a bounding box and a point … … 306 311 BoundingBox b = *this; 307 312 return b += u; 308 } ;313 } 309 314 310 315 ///Increments a bounding box with an other bounding box … … 315 320 } 316 321 return *this; 317 } ;322 } 318 323 319 324 ///Sums two bounding boxes … … 321 326 BoundingBox b = *this; 322 327 return b += u; 323 } ;328 } 324 329 325 330 };//class Boundingbox
Note: See TracChangeset
for help on using the changeset viewer.