# eyeamnoob/circles architecture

> Architecture diagram of the GitHub repository eyeamnoob/circles, 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/eyeamnoob/circles
- Repository: https://github.com/eyeamnoob/circles

## Overview

##### Analyzing the File Structure
- At the top level, you have a makefile for building the project and a README.
- The source code is housed in the src directory.
- src/main.c is the entry point of the application.
- The src/utils directory contains general utility functions (for example, my_math.h) which likely provide mathematical operations needed for circle computations and intersection logic.
- The bin directory holds the built binary once compilation is complete.

##### Key Components
a. Main Application Module:
- Represented by src/main.c, this module orchestrates the program execution.
b. Objects/Domain Modules (Visualization and Geometry):
- Canvas: Likely responsible for the drawing surface or environment.
- Circle: Represents the circle objects being visualized.
- Intersect: Contains the logic for identifying interactions (or intersections) between circles.
c. Utility Module:
- My_math: Provides the mathematical functions required for accurate calculations in drawing and detecting circle intersections.
d. Build and Execution:
- The makefile is used to compile the project. The compiled binary is placed in the bin directory.

##### Relationships and Interactions
- The main module (src/main.c) is the central controller and interacts with all domain modules (objects) and util functions.
- The utility module (my_math.h) is a shared dependency that provides supporting functions (such as geometry calculations) to the domain modules (especially for circle intersection logic).

##### Architectural Patterns and Design Principles
- Reusability: Utility functions (my_math) can be reused across the different objects that need mathematical operations.
- Simplicity: A lightweight, procedural C program where each module’s header and implementation are loosely coupled, which is typical for small-scale C applications.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Application Core"
        A["Main Module (main.c)"]:::core
    end

    subgraph "Domain Modules"
        B["Canvas Module (canvas.h)"]:::domain
        C["Circle Module (circle.h)"]:::domain
        D["Color Module (color.h)"]:::domain
        E["Intersect Module (intersect.h)"]:::domain
    end

    subgraph "Utility Modules"
        F["Math Utilities (my_math.h)"]:::utility
    end

    subgraph "Infrastructure"
        G1["Build System (makefile)"]:::infra
        G2["Compiled Binary (bin)"]:::infra
    end

    %% Relationships from Main Module to Domain Modules
    A -->|"controls"| B
    A -->|"controls"| C
    A -->|"controls"| D
    A -->|"controls"| E

    %% Relationships from Domain Modules to Utility Modules
    C -->|"uses"| F
    E -->|"uses"| F

    %% Build System relations
    G1 -->|"produces"| G2
    G1 -->|"builds"| A

    %% Click Events
    click A "https://github.com/eyeamnoob/circles/blob/master/src/main.c"
    click B "https://github.com/eyeamnoob/circles/blob/master/src/objects/canvas.h"
    click C "https://github.com/eyeamnoob/circles/blob/master/src/objects/circle.h"
    click D "https://github.com/eyeamnoob/circles/blob/master/src/objects/color.h"
    click E "https://github.com/eyeamnoob/circles/blob/master/src/objects/intersect.h"
    click F "https://github.com/eyeamnoob/circles/blob/master/src/utils/my_math.h"
    click G1 "https://github.com/eyeamnoob/circles/tree/master/makefile"
    click G2 "https://github.com/eyeamnoob/circles/tree/master/bin"

    %% Styles
    classDef core fill:#F9E79F,stroke:#D35400,stroke-width:2px;
    classDef domain fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef utility fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef infra fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
```
