src/proto2/Vector.hh
branchno-netsession
changeset 41 ca80cd67785d
parent 35 e21cfda0edde
--- a/src/proto2/Vector.hh	Thu Nov 20 23:20:00 2008 +0000
+++ b/src/proto2/Vector.hh	Thu Nov 20 23:45:33 2008 +0000
@@ -2,6 +2,7 @@
 #define COOR_H
 
 #include <iostream>
+#include <cmath>
 
 /**
  * 2D Vector class. Implements standard vector operations.
@@ -55,6 +56,9 @@
         this->x /= d;
         this->y /= d;
     }
+    T length() const {
+        return sqrt(x*x+y*y);
+    }
 };
 
 template<typename T>