diff options
author | neoraider <devnull@localhost> | 2007-09-16 16:07:03 +0200 |
---|---|---|
committer | neoraider <devnull@localhost> | 2007-09-16 16:07:03 +0200 |
commit | 01e98d51fedf65ad71d468c3b0410d6e7764a384 (patch) | |
tree | 3259e2655249865cd335d96cc4b32815a4236532 /Vertex.h | |
parent | 2bdbece75f9dcc9b98d7f9d5794c4b5e5f441b26 (diff) | |
download | zoomedit-01e98d51fedf65ad71d468c3b0410d6e7764a384.tar zoomedit-01e98d51fedf65ad71d468c3b0410d6e7764a384.zip |
zoomedit: C++ized Vertex
Diffstat (limited to 'Vertex.h')
-rw-r--r-- | Vertex.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Vertex.h b/Vertex.h new file mode 100644 index 0000000..e7d47ce --- /dev/null +++ b/Vertex.h @@ -0,0 +1,31 @@ +#ifndef VERTEX_H_ +#define VERTEX_H_ + +class Vertex { + private: + double x, y; + public: + Vertex() {x = y = 0.0;} + Vertex(const Vertex &v) {x = v.x; y = v.y;} + Vertex(double x, double y) {this->x = x; this->y = y;} + + double getX() const {return x;} + void setX(double x) {this->x = x;} + + double getY() const {return y;} + void setY(double y) {this->y = y;} + + void setLocation(const Vertex &v) {x = v.x; y = v.y;} + void setLocation(double x, double y) {this->x = x; this->y = y;} + + double distanceSq(const Vertex &v) const; + double distance(const Vertex &v) const; + + Vertex operator+(const Vertex &v) const; + Vertex operator-(const Vertex &v) const; + + Vertex& operator+=(const Vertex &v); + Vertex& operator-=(const Vertex &v); +}; + +#endif /*VERTEX_H_*/ |