super("Rectangular Obstacle Scene", params);
Scene2D<AbstractAgent2D<?>> scene;
Scene2D<AbstractAgent2D<?>> sceneComplete = new Scene2D<AbstractAgent2D<?>>("Complete scene", params);
int numberOfGridsPerDir = numberOfRowsAndColumns;
Random rand = new Random(params.getSeed());
Rectangle2D boundThis;
double factor;
for (int i = 0; i < numberOfGridsPerDir; i++) {
for (int j = 0; j < numberOfGridsPerDir; j++) {
scene = new ObstacleScene(params);
scene.removeAgent(rand.nextInt(4));
scene.addCollidingAgent(
new JebensAgent(0, null, params),
scene.getBoundingBox().middle(),
0,
new Vector2D(1, 1));
scene.translateScene(new Vector2D(750 * i, 750 * j));
sceneComplete.addScene(scene);
}
}
boundThis = sceneComplete.getBoundingBox();
Vector2D middleOfThis;
if (boundThis != null) {
middleOfThis = boundThis.middle();
} else {
middleOfThis = new Vector2D(0, 0);
}
middleOfThis.mult(-1);
sceneComplete.translateScene(middleOfThis);