extern "C" void fl_generate_sequence(int nb_images,
int width, int height,
+ int nb_shapes,
int random_shape_size, int random_colors,
unsigned char *output) {
- const scalar_t world_width = width * 8;
- const scalar_t world_height = height * 8;
- const scalar_t scaling = 0.125;
+ const scalar_t super_definition = 8;
+ const scalar_t world_width = width * super_definition;
+ const scalar_t world_height = height * super_definition;
+ const scalar_t scaling = 1 / super_definition;
const scalar_t dt = 0.1;
const int nb_iterations_per_steps = 5;
int every_nth = 16;
int nb_simulated_frames = 1 + (nb_images - 1) * every_nth;
int random_grasp = 1;
- int nb_shapes = 10;
Universe *universe;
Polygon *grabbed_polygon;
int failed;
+ int total_nb_attempts = 0;
+ const int max_total_nb_attempts = 1000000;
+
do {
if(random_grasp) {
grab_start_x = world_width * (0.1 + 0.8 * drand48());
}
grabbed_polygon = universe->pick_polygon(grab_start_x, grab_start_y);
+
} while(!grabbed_polygon);
failed = 0;
}
}
}
+
+ total_nb_attempts++;
+
+ if(total_nb_attempts >= max_total_nb_attempts) {
+ cerr << "There was " << max_total_nb_attempts << " attempts at generating the sequences." << endl;
+ abort();
+ }
+
} while(failed);
for(int t = 0; t < nb_images; t++) {