As it stands, I have a game I writing, utilizing PCG (Procedural Content Generation). I was wondering if there was a better way to store the vertices of my polygon with certain library restrictions (Box2D is my chosen physics engine). Currently, I have this:
std::vector<b2Vec2> topChain;
std::vector<b2Vec2> bottomChain;
std::vector<b2Vec2> eastCap;
std::vector<b2Vec2> westCap;
Box2D has a limitation ( as far as I'm aware ) that polygon fixtures can contain at most 8 vertices. Given I have sloping terrain, 8 vertices isn't enough for the smooth terrain I'm looking for. The solution was to slice each sloping section into a quad.
However, my concern here is efficiency, and one thing I noticed is the time and memory it requires to fill these vectors.
Hovering over each class name in Visual Studio, shows that b2Vec2 is a whopping 8 bytes per.
The container class of std::vector takes another 32 bytes.
What would be the most efficient data structure for this problem?