]> Shamusworld >> Repos - architektonas/blobdiff - src/vector.h
Added line-to-circle intersection code.
[architektonas] / src / vector.h
index 62438986ef653bd0462d9e600e307105ce592ba3..e59b0e86eed7d1a6f8f111643742feda3bd85a4b 100644 (file)
@@ -13,6 +13,9 @@
 // What we'll do here is create the vector type and use typedef to alias Point
 // to it. Yeah, that's it.
 
+class Vector;
+typedef Vector Point;
+
 class Vector
 {
        public:
@@ -22,20 +25,20 @@ class Vector
                Vector operator=(Vector const v);
                Vector operator+(Vector const v);
                Vector operator-(Vector const v);
-               Vector operator-(void);                                 // Unary negation
-               Vector operator*(double const v);               // Vector times constant (double)
-               Vector operator*(float const v);                // Vector times constant (float)
-               Vector operator/(double const v);               // Vector divided by constant (double)
-               Vector operator/(float const v);                // Vector divided by constant (float)
-               Vector operator*(Vector const v);               // Vector product
-               double Dot(Vector const v);                             // Dot product
-
-               Vector& operator*=(double const v);             // Vector times constant self-assignment
-               Vector& operator/=(double const v);             // Vector divided by constant self-assignment
-               Vector& operator+=(Vector const v);             // Vector plus Vector self-assignment
-               Vector& operator+=(double const v);             // Vector plus constant self-assignment
-               Vector& operator-=(Vector const v);             // Vector minus Vector self-assignment
-               Vector& operator-=(double const v);             // Vector minus constant self-assignment
+               Vector operator-(void);                         // Unary negation
+               Vector operator*(double const v);       // Vector times constant (double)
+               Vector operator*(float const v);        // Vector times constant (float)
+               Vector operator/(double const v);       // Vector divided by constant (double)
+               Vector operator/(float const v);        // Vector divided by constant (float)
+               Vector operator*(Vector const v);       // Vector product
+               double Dot(Vector const v);                     // Dot product
+
+               Vector& operator*=(double const v);     // Vector times constant self-assignment
+               Vector& operator/=(double const v);     // Vector divided by constant self-assignment
+               Vector& operator+=(Vector const v);     // Vector plus Vector self-assignment
+               Vector& operator+=(double const v);     // Vector plus constant self-assignment
+               Vector& operator-=(Vector const v);     // Vector minus Vector self-assignment
+               Vector& operator-=(double const v);     // Vector minus constant self-assignment
 
                bool operator==(Vector const v);                // Check for equality
                bool operator!=(Vector const v);                // Check for inequality
@@ -49,6 +52,7 @@ class Vector
 
                static double Dot(Vector v1, Vector v2);
                static double Magnitude(Vector v1, Vector v2);
+               static double Angle(Point p1, Point p2);
                static double Parameter(Vector v1, Vector v2, Vector p);
                static Vector Normal(Vector v1, Vector v2);
                static double AngleBetween(Vector a, Vector b);
@@ -57,6 +61,4 @@ class Vector
                double x, y, z;
 };
 
-typedef Vector Point;
-
 #endif // __VECTOR_H__