added ball to ball collisions
[physics.git] / src / Vector2.cpp
index 2c25375..d13ea95 100644 (file)
@@ -63,7 +63,16 @@ float Vector2::angle() const
 }
 float Vector2::length() const
 {
-    return sqrt(x*x + y*y);
+    return sqrt(sqrLength());
+}
+float Vector2::sqrLength() const
+{
+    return x*x + y*y;
+}
+
+float Vector2::dot(const Vector2& v) const
+{
+    return x*v.x + y*v.y;
 }