massive cleaning of file section headers
[physics.git] / src / Vector2.h
CommitLineData
ad9f1fb6
PG
1#ifndef VECTOR2_H
2#define VECTOR2_H
3
4#include <string>
5
6using std::string;
7
8/// ***** Header Class *****
9class Vector2
10{
11 public:
12 float x;
13 float y;
14
15 Vector2();
16 Vector2(float, float);
17 Vector2(const Vector2&);
617dcc71 18 ~Vector2();
ad9f1fb6
PG
19
20 void zero();
21 void unit();
22
23 float angle() const;
24 float length() const;
25
26 Vector2 add(const Vector2&) const;
27 Vector2 subtract(const Vector2&) const;
28 Vector2 divide(float) const;
29 Vector2 multiply(float) const;
30
31 string toString() const;
32 void print() const;
33};
34
35/// ***** Header Methods *****
617dcc71
PG
36
37// definitions of the operators are external because (float, Vector2) would
38// fail inside the class
39
ad9f1fb6
PG
40Vector2 operator+(const Vector2&, const Vector2&);
41Vector2 operator-(const Vector2&, const Vector2&);
42Vector2 operator*(float, const Vector2&);
43Vector2 operator*(const Vector2&, float);
44Vector2 operator/(const Vector2&, float);
45
46void operator+=(Vector2&, const Vector2&);
47void operator-=(Vector2&, const Vector2&);
48void operator*=(Vector2&, float);
49void operator/=(Vector2&, float);
50
51#endif // VECTOR2_H