-/*
- * Vector.h
- *
- * Created on: Aug 6, 2012
- * Author: holy
- */
-
#ifndef GEOMETRY_VECTOR_H_
#define GEOMETRY_VECTOR_H_
namespace geometry {
+/// Basic vector class with emphasis on graphical/computational ease of use
+/// rather than mathematical accuracy ;) .
template<class Scalar>
class Vector {
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<Scalar> FromIndex(Scalar index, Scalar lineLength) {
return Vector<Scalar>(index % lineLength, index / lineLength);