Fractol 1.0
A fractal visualization project implemented in C.
|
Entry point for the Fractol application. More...
#include "fractol.h"
Go to the source code of this file.
Functions | |
static int | is_valid_number (const char *str) |
Validates if a string represents a valid number. | |
static void | exit_with_error (const char *message, char *argv[]) |
Prints an error message and terminates the program. | |
static void | validate_arguments (int argc, char *argv[]) |
Validates the command-line arguments for fractal rendering. | |
static void | initialize_window (t_data *data, char *argv[]) |
Initializes the MLX42 rendering environment. | |
int | main (int argc, char *argv[]) |
Main entry point for the fractal rendering program. | |
Entry point for the Fractol application.
This file contains the main function and orchestrates the entire fractal rendering process. It handles:
The program terminates gracefully on completion or reports error for invalid inputs.
Definition in file main.c.
|
static |
Prints an error message and terminates the program.
This function displays an error, the correct usage off the program, and list of available fractal types with examples. It then terminates the program with a failure status.
message | Error message to display. |
argv | Command-line arguments, used to show the program name in usage examples. |
Definition at line 87 of file main.c.
|
static |
Initializes the MLX42 rendering environment.
This function sets up the environment for rendering fractals by:
If Julia set parameters (c[COMPLEX_RE]
or c[COMPLEX_IM]
) are outside the range [-2.0, 2.0], it issues a warning about potential visual effects. The function terminates the program in case of initialization failures.
data | Pointer to the data structure containing fractal information, offsets, zoom, and MLX42 resources. |
argv | Array of argument strings, where argv[1] is used as the window title. |
Definition at line 167 of file main.c.
|
static |
Validates if a string represents a valid number.
This function checks iff the input string is a valid number, considering:
str | Input string to validate |
Definition at line 47 of file main.c.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Main entry point for the fractal rendering program.
This function orchestrates the entire fractal rendering process by:
argc | Number of arguments passed to the program. |
argv | Array of argument strings, including the program name and input parameters. |
EXIT_SUCCESS
on successful execution, or terminates on error. Definition at line 215 of file main.c.
|
static |
Validates the command-line arguments for fractal rendering.
This function checks that the user has specified a valid fractal type and the correct parameters. The supported fractals and their requirements are:
mandelbrot
: No additional arguments.julia
: Requires exactly two valid numbers representing the real and imaginary part of the parameter.If the arguments are invalid, the function calls exit_with_error()
to display an appropiate error message and terminate the program.
argc | Number of command-line arguments passed to the program. |
argv | Array of command-line argument strings. |
Definition at line 122 of file main.c.