Changeset 1257:7101e2c3a881 in lemon-0.x for src/lemon/xy.h
- Timestamp:
- 03/25/05 09:21:43 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1684
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/xy.h
r1202 r1257 39 39 /// @{ 40 40 41 /// A two dimensional vector (plainvector) implementation42 43 /// A two dimensional vector (plainvector) implementation41 /// A simple two dimensional vector (plainvector) implementation 42 43 /// A simple two dimensional vector (plainvector) implementation 44 44 ///with the usual vector 45 45 /// operators. … … 55 55 T x,y; 56 56 57 ///Default constructor : both coordinates become 058 xy() : x(0), y(0){}57 ///Default constructor 58 xy() {} 59 59 60 60 ///Constructing the instance from coordinates … … 66 66 67 67 ///Gives back the square of the norm of the vector 68 T normSquare() {68 T normSquare() const { 69 69 return x*x+y*y; 70 70 }; 71 71 72 72 ///Increments the left hand side by u 73 xy<T>& operator +=(const xy<T>& u) {73 xy<T>& operator +=(const xy<T>& u) { 74 74 x += u.x; 75 75 y += u.y; … … 78 78 79 79 ///Decrements the left hand side by u 80 xy<T>& operator -=(const xy<T>& u) {80 xy<T>& operator -=(const xy<T>& u) { 81 81 x -= u.x; 82 82 y -= u.y; … … 85 85 86 86 ///Multiplying the left hand side with a scalar 87 xy<T>& operator *=(const T &u) {87 xy<T>& operator *=(const T &u) { 88 88 x *= u; 89 89 y *= u; … … 92 92 93 93 ///Dividing the left hand side by a scalar 94 xy<T>& operator /=(const T &u) {94 xy<T>& operator /=(const T &u) { 95 95 x /= u; 96 96 y /= u; … … 99 99 100 100 ///Returns the scalar product of two vectors 101 T operator *(const xy<T>& u) {101 T operator *(const xy<T>& u) const { 102 102 return x*u.x+y*u.y; 103 103 }; … … 135 135 136 136 ///Testing equality 137 bool operator==(const xy<T> &u) {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 bool operator!=(xy u) {142 bool operator!=(xy u) const { 143 143 return (x!=u.x) || (y!=u.y); 144 144 };
Note: See TracChangeset
for help on using the changeset viewer.