4 #include <iostream> // Needed for 'friend ostream' below
7 * Represents a 3d vector (x/y/z)
9 * @author Andrew Mustun
15 Vector(double vx, double vy, double vz = 0.0);
17 //Not sure why this is here, explicit means no implicit conversion when assigning values
19 //OK, you might want this in certain situations such as
20 // Vector(true), but still not 100% sure why this is here.
21 explicit Vector(bool valid);
24 void set(double vx, double vy, double vz = 0.0);
25 void setPolar(double radius, double angle);
27 double distanceTo(const Vector & v) const;
29 double angleTo(const Vector & v) const;
30 double magnitude() const;
31 Vector lerp(const Vector & v, double t) const;
33 bool isInWindow(const Vector & firstCorner, const Vector & secondCorner);
35 Vector move(Vector offset);
36 Vector rotate(double ang);
37 Vector rotate(Vector center, double ang);
38 Vector scale(Vector factor);
39 Vector scale(Vector center, Vector factor);
40 Vector mirror(Vector axisPoint1, Vector axisPoint2);
42 Vector operator+(const Vector & v) const;
43 Vector operator-(const Vector & v) const;
44 Vector operator*(double s) const;
45 Vector operator/(double s) const;
46 Vector operator-() const;
48 void operator+=(const Vector & v);
49 void operator-=(const Vector & v);
50 void operator*=(double s);
52 bool operator==(const Vector & v) const;
53 bool operator!=(const Vector & v) const;
56 static Vector minimum(const Vector & v1, const Vector & v2);
57 static Vector maximum(const Vector & v1, const Vector & v2);
58 static Vector crossP(const Vector & v1, const Vector & v2);
59 static double dotP(const Vector & v1, const Vector & v2);
61 friend std::ostream & operator<<(std::ostream &, const Vector & v);
74 #endif // __VECTOR_H__