#include #include "PhysicsElement.h" #include "Spring.h" #include "Block.h" #include "Simulator.h" using namespace std; int main (int argc, char * argv[]) { vector element[3]; Block b1(1e15f, 0f, 0f, 0f); // f: float Block * pb2 = new Block(1f, 0.10f, 1f, 0f); // mass, width, position, speed Spring spring(0.7f, 1f); // rest length and stiffness spring.attachBlock_a(b1); spring.attachBlock_b(*pb2); element.push_back(&b1); element.push_back(&spring); element.push_back(pb2); Simulator sim; sim.setPhysicsElements(element); sim.simulate(0.0001f, 40f, 0.1f); // delta time, total time, sampling time. }