diff options
author | Stijn Buys <ingar@osirion.org> | 2009-08-16 17:34:00 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-08-16 17:34:00 +0000 |
commit | d763e294f44eb38b94bf7e2055b77a982b72b7c0 (patch) | |
tree | 37f91c6b7fee58fcecfbfc54dda3f71eb8617b9f /src/math/vector2f.h | |
parent | 95cc140404c6524ea16e193e1421e826b239114f (diff) |
more constness
Diffstat (limited to 'src/math/vector2f.h')
-rw-r--r-- | src/math/vector2f.h | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/math/vector2f.h b/src/math/vector2f.h index 6258d85..ba60aa1 100644 --- a/src/math/vector2f.h +++ b/src/math/vector2f.h @@ -78,6 +78,28 @@ public: return coord[index]; } + /// x coordinate + inline float width() const { + return coord[0]; + } + + /// y coordinate + inline float height() const { + return coord[1]; + } + + /// x coordinate + inline float x() const { return coord[0]; } + + /// y coordinate + inline float y() const { return coord[1]; } + + /// mutable reference to the x coordinate + inline float & get_x() { return coord[0]; } + + /// mutable reference to the y coordinate + inline float & get_y() { return coord[1]; } + /// a pointer to the internal data inline float *ptr() const { return (float *) coord; @@ -91,20 +113,6 @@ public: return ((x >= 0) && (y >= 0) && (x <= coord[0]) && (y <= coord[1])); } - inline float width() const { - return coord[0]; - } - - inline float height() const { - return coord[1]; - } - - /// x coordinate - float &x; - - /// y coordinate - float &y; - private: float coord[2]; }; |