src/proto2/Vector.hh
changeset 124 2fd698e04779
parent 99 c9b96dcfe4ee
child 130 81406f8b7535
equal deleted inserted replaced
123:7efb63402b2b 124:2fd698e04779
    60         this->y /= d;
    60         this->y /= d;
    61     }
    61     }
    62     T length() const {
    62     T length() const {
    63         return sqrt(x*x+y*y);
    63         return sqrt(x*x+y*y);
    64     }
    64     }
       
    65     _Vector roundToInt() const {
       
    66         return _Vector((int)x, (int)y);
       
    67     }
    65 };
    68 };
    66 
    69 
    67 template<typename T>
    70 template<typename T>
    68 bool operator==(const _Vector<T> &v1, const _Vector<T> &v2) {
    71 bool operator==(const _Vector<T> &v1, const _Vector<T> &v2) {
    69     return ((v1.x == v2.x) && (v1.y == v2.y));
    72     return ((v1.x == v2.x) && (v1.y == v2.y));