/**
* @brief A struct to pass arguments to the mandelbrot_thread function
*
*/
typedef struct {
bool **grid;
int width;
int height;
int start_x;
int start_y;
double min_x;
double max_x;
double min_y;
double max_y;
} thread_args;
/**
* @brief Calculate the mandelbrot set for sub-grid of pixels
*
* @param args The sub-section of the grid to calculate
* @return void* NULL
*/
void *mandelbrot_thread(void *args);
/**
* @brief Use multiple threads to calculate the mandelbrot set for a grid of pixels
*
* @param grid The grid of boolean values to store the mandelbrot set
* @param width The width of the grid
* @param height The height of the grid
* @param min_x The minimum x value of the screen
* @param max_x The maximum x value of the screen
* @param min_y The minimum y value of the screen
* @param max_y The maximum y value of the screen
* @param num_threads The number of threads to use
*/
void mandelbrot_grid(bool **grid, int width, int height, double min_x, double max_x, double min_y, double max_y, int num_threads);
/**
* @brief Create a grid object
*
* @param width The width of the grid
* @param height The height of the grid
* @return The grid created
*/
bool** create_grid(int width, int height) {
bool **grid = malloc(width * sizeof(bool *));
if (!grid) {
perror("Erreur d'allocation de mémoire !\n");
exit(1);
}
for (int i = 0; i < width; i++) {
grid[i] = calloc(height, sizeof(bool));
if (!grid[i]) {
perror("Erreur d'allocation de mémoire !\n");
exit(1);
}
}
return grid;
}