# all23tor/makenewtonfractals architecture

> Architecture diagram of the GitHub repository all23tor/makenewtonfractals, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/all23tor/makenewtonfractals
- Repository: https://github.com/all23tor/makenewtonfractals

## Overview

##### Main Components
- User Input Interface:
- Polynomial Module:
- Represented via Polynomial.hpp/cpp; it handles polynomial evaluation (using Horner’s method), differentiation, and root-finding using the Durand-Kerner algorithm.
- Newton Fractal Module:
- Defined in NewtonFractal.hpp/cpp; it applies Newton’s Method for each pixel, determines the corresponding root (by distance criteria) and manages coloring rules (including eccentricity and iteration count).
- BMP Output Module:
- Responsible for generating the .bmp file using a BITMAPINFOHEADER DIB header format and writing the image to disk (in the BMPs folder).

##### Interactions Between Components
- The Polynomial module computes the roots and provides the information to the Newton Fractal module.
- The output from the fractal generation process is then passed to the BMP Output module which renders the final image file.

##### Technologies and Relevant Details
- Programming Language: C++ (with CMake as the build system, as seen by CMakeLists.txt)
- Algorithms: Horner’s method for evaluation and Durand-Kerner for root finding; Newton’s method to compute fractals.
- File Output: .bmp image generation from computed pixel data using a BITMAPINFOHEADER.

##### Final Recommendations
- If desired, include ancillary components like error handling or configuration files (like CMakeLists.txt) as supporting elements outside the primary flow.

## Diagram (Mermaid)

```mermaid
graph TD
    A["User Input"]:::input
    subgraph "Pre-processing Modules"
        B["Polynomial Module"]:::compute
        C["Color Module"]:::compute
    end
    D["Newton Fractal Module"]:::compute
    E["BMP Output Module"]:::output

    A -->|"coefficients"| B
    A -->|"colorSelections"| C
    B -->|"computedRoots"| D
    C -->|"colorMappings"| D
    D -->|"imageData"| E

    click A "https://github.com/all23tor/makenewtonfractals/blob/main/main.cpp"
    click B "https://github.com/all23tor/makenewtonfractals/blob/main/include/Polynomial.hpp"
    click B "https://github.com/all23tor/makenewtonfractals/blob/main/src/Polynomial.cpp"
    click C "https://github.com/all23tor/makenewtonfractals/blob/main/include/Color.hpp"
    click C "https://github.com/all23tor/makenewtonfractals/blob/main/src/Color.cpp"
    click D "https://github.com/all23tor/makenewtonfractals/blob/main/include/NewtonFractal.hpp"
    click D "https://github.com/all23tor/makenewtonfractals/blob/main/src/NewtonFractal.cpp"
    click E "https://github.com/all23tor/makenewtonfractals/blob/main/include/BMP.hpp"
    click E "https://github.com/all23tor/makenewtonfractals/blob/main/src/BMP.cpp"

    classDef input fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef compute fill:#ff9999,stroke:#333,stroke-width:2px;
    classDef output fill:#99ccff,stroke:#333,stroke-width:2px;
```
