Fractol 1.0
A fractal visualization project implemented in C.
|
Core calculations for fractal rendering. More...
#include "fractol.h"
Go to the source code of this file.
Functions | |
void | calculate_scales_and_limits (t_render_vars *vars, t_data *data) |
Calculates the scales and starting points for the fractal rendering. | |
int | precompute_coords (double **c_re, double **c_im, t_render_vars *vars) |
Precomputes the coordinates for each pixel in the fractal. | |
void | render_fractal (t_data *data) |
Renders the chosen fractal on the screen. | |
int | calculate_color (int iterations) |
Calculates the color of a pixel based on how many iterations it takes to "escape". | |
Core calculations for fractal rendering.
This file contains the functions responsible for performing the core calculations required to render fractals. It handles:
Mapping iteration counts to colors for visually representing fractal complexity.
For non-technical users:
Definition in file calcs.c.
int calculate_color | ( | int | iterations | ) |
Calculates the color of a pixel based on how many iterations it takes to "escape".
Calculates the color based on the number of iterations.
This function determines the color of each pixel in the fractal by mapping the iteration count (how many steps we are needed to reach a threshold) to a color gradient.
For non-technical users:
iterations | Number of iterations required for the opint to "escape". |
Definition at line 131 of file calcs.c.
void calculate_scales_and_limits | ( | t_render_vars * | vars, |
t_data * | data | ||
) |
Calculates the scales and starting points for the fractal rendering.
Calculates scales and limits for rendering fractals.
This function determines how the fractal is scaled and positioned on the screen. It computes the scale factors for each pixel and establishes the starting points ffor the real and imaginary part of the fractal based on the zoom level and offsets.
For non-technical users:
vars | Pointer to the rendering variables structure. |
data | Pointer to the main data structure containing fractal information. |
Definition at line 52 of file calcs.c.
int precompute_coords | ( | double ** | c_re, |
double ** | c_im, | ||
t_render_vars * | vars | ||
) |
Precomputes the coordinates for each pixel in the fractal.
Precomputes coordinates for fractal rendering.
This function calculates the real and imaginary parts of the fractal for each pixel on the screen, storing them in arrays for quick access during rendering. It ensures that every point is prepared for the fractal calculations.
For non-technical users:
c_re | Pointer to the array storing real coordinates. |
c_im | Pointer to the array storing imaginary coordinates. |
vars | Pointer to the rendering variables structure. |
Definition at line 78 of file calcs.c.
void render_fractal | ( | t_data * | data | ) |
Renders the chosen fractal on the screen.
Render the specified fractal.
This function selects the appropiate rendering algorithm based on the fractal type chosen by the user (Julia or Mandelbrot) and renders it on the screen.
For non-technical users:
data | Pointer to the main data structure containing fractal and rendering details. |
Definition at line 108 of file calcs.c.