ben18785 / MosquitoBorneDisease

A fully-tested opensource modelling environment for spatial mosquito ecology
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

Vector class for locations #5

Closed fcooper8472 closed 5 years ago

fcooper8472 commented 5 years ago

Currently positions in space are handled with a std::pair<double, double>. I don't like this for a couple of reasons:

  1. std::pair is designed for heterogeneous collections of objects, not for things with the same type
  2. Doesn't generalise well to higher dimensions

I suggest adding a lightweight Vector class in the mbd:: namespace, such that a vector would be declared as mbd::Vector<int, 3>, say, for a 3-d vector of ints.

Then wherever relevant, using Coords2d = mbd::Vector<double, 2>; to provide a coordinate type. If, in the future, a linear algebra library such as Eigen was used, all that would need to change is the using type alias.

fcooper8472 commented 5 years ago

Done.