         }
     }
 
-    var direction : CGFloat {
+    var magnitudeSquared: CGFloat {
+        get {
+            return x ** 2 + y ** 2
+        }
+    }
+
+    var direction: CGFloat {
         get {
             return atan2(self)
         }

        y = sin(direction) * magnitude
    }

    var magnitude : CGFloat {
        get {
            return sqrt(x ** 2 + y ** 2)
        }


// MARK: dotProduct and crossProduct

public func dotProduct(lhs:CGPoint, rhs:CGPoint) -> CGFloat {
    return lhs.x * rhs.x + lhs.y * rhs.y
}

public func crossProduct(lhs:CGPoint, rhs:CGPoint) -> CGFloat {
    return lhs.x * rhs.y - lhs.y * rhs.x
}

// TODO: Depecate in favour of the function
public extension CGPoint {
    func dotProduct(v:CGPoint) -> CGFloat {
        return SwiftGraphics.dotProduct(self, v)
    }

    func crossProduct(v:CGPoint) -> CGFloat {
        return SwiftGraphics.crossProduct(self, v)
    }
}

