X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgeometry%2FVector.h;h=c0b22e51d9b93d154d6dcb3ca1234d8fb7c3ae00;hb=350055a7ff27c74882aff8a4d6af2014782f830b;hp=c6a42fbba069e4b98bdac5acfb5bff9ba2242de5;hpb=be3b4e75c82b6e9d2b5c4300138d490ec1a4932a;p=l2e.git diff --git a/src/geometry/Vector.h b/src/geometry/Vector.h index c6a42fb..c0b22e5 100644 --- a/src/geometry/Vector.h +++ b/src/geometry/Vector.h @@ -14,6 +14,8 @@ namespace geometry { +/// Basic vector class with emphasis on graphical/computational ease of use +/// rather than mathematical accuracy ;) . template class Vector { @@ -29,6 +31,9 @@ public: Scalar X() const { return x; } Scalar Y() const { return y; } + Scalar &X() { return x; } + Scalar &Y() { return y; } + Scalar Index(Scalar lineLength) const { return Y() * lineLength + X(); } static Vector FromIndex(Scalar index, Scalar lineLength) { return Vector(index % lineLength, index / lineLength);