Surface2D.hpp
This file defines a templated class to represent a 2D suface capable of maintaining data about which 2D bodies are currently on that surface and rapidly identifying if they are overlapping.
BODY_TYPE is the class that represents the body geometry. BODY_INFO represents the internal infomation about the body, including the controller.
Member functions include: Surface2D(double _width, double _height); const Point & GetMaxPosition() const; vector<BODY_TYPE *> & GetBodySet(); const vector<BODY_TYPE *> & GetConstBodySet() const; Surface2D<BODY_TYPE, BODY_INFO> & AddBody(BODY_TYPE * new_body); void TestCollisions(std::function<bool(BODY_TYPE &, BODY_TYPE &)> collide_fun);
Development notes:
Need a good function to remove a body; now we have to use GetBodySet() and modify it.
-
template<typename BODY_TYPE>
class Surface2D - #include <Surface2D.hpp>