# mandliors/gaegebra architecture

> Architecture diagram of the GitHub repository mandliors/gaegebra, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mandliors/gaegebra
- Repository: https://github.com/mandliors/gaegebra

## Overview

GaeGebra is a C/SDL2 coordinate-geometry desktop app with a responsive UI. Users choose a construction tool, interact with the coordinate plane to create or manipulate geometry, and see it rendered in the window. The README documents points, lines, circles, parallel/perpendicular lines, angle bisectors, and tangents, plus zooming and coordinate transforms. The graph also captures the app/window and UI/rendering layers. Relationships come from the README and SOURCE INDEX references; unsampled modules are represented only where documented or referenced.

Main entry points: [`src/main.c`](https://github.com/mandliors/gaegebra/blob/main/src/main.c) (Application workflow), [`src/geometry/coordinate_system/coordinate_system.c`](https://github.com/mandliors/gaegebra/blob/main/src/geometry/coordinate_system/coordinate_system.c) (Coordinate plane), [`src/geometry/shape/shape.c`](https://github.com/mandliors/gaegebra/blob/main/src/geometry/shape/shape.c) (Geometry constructions), [`src/renderer/renderer.c`](https://github.com/mandliors/gaegebra/blob/main/src/renderer/renderer.c) (Drawing renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["App interaction"]
  node_main["Application workflow<br/>[main.c]"]
  node_input["Input state<br/>[input.c]"]
end

subgraph group_geometry["Geometry"]
  node_coordinate["Coordinate plane"]
  node_shapes["Geometry constructions<br/>[shape.c]"]
  node_intersection["Intersection calculations<br/>[intersection.c]"]
  node_vectors2["2D vector math<br/>[vector2.c]"]
  node_math["General math<br/>[math.c]"]
end

subgraph group_ui["User interface"]
  node_ui["UI management<br/>[ui.c]"]
  node_elements["UI elements<br/>[ui_element.c]"]
  node_constraints["Responsive constraints<br/>[ui_constraint.c]"]
end

subgraph group_platform["Window and rendering"]
  node_app["App lifecycle<br/>[app.c]"]
  node_window["Window and events<br/>[window.c]"]
  node_renderer["Drawing renderer<br/>[renderer.c]"]
  node_texture["Texture resources<br/>[texture.c]"]
  node_font["Font resources<br/>[font.c]"]
  node_color["Color utilities<br/>[color.c]"]
  node_vector["Dynamic collections<br/>[vector.c]"]
end

node_user(("User"))
node_sdl{{"SDL2 runtime"}}

node_user -->|"uses tools"| node_main
node_main -->|"initializes"| node_app
node_main -->|"creates window"| node_window
node_main -->|"builds interface"| node_ui
node_main -->|"handles construction"| node_coordinate
node_main -->|"creates shapes"| node_shapes
node_app -->|"manages windows"| node_window
node_app -->|"updates input"| node_input
node_app -->|"updates UI"| node_ui
node_window -->|"dispatches events"| node_input
node_window -->|"updates and renders"| node_ui
node_coordinate -->|"stores shapes"| node_shapes
node_coordinate -->|"draws plane"| node_renderer
node_coordinate -->|"uses calculations"| node_intersection
node_coordinate -->|"uses math"| node_math
node_shapes -->|"uses coordinate plane"| node_coordinate
node_shapes -->|"draws geometry"| node_renderer
node_shapes -->|"reads interaction"| node_input
node_intersection -->|"operates on shapes"| node_shapes
node_ui -->|"manages elements"| node_elements
node_elements -->|"uses constraints"| node_constraints
node_elements -->|"draws controls"| node_renderer
node_elements -->|"handles interaction"| node_input
node_renderer -->|"draws textures"| node_texture
node_renderer -->|"draws text"| node_font
node_main -->|"loads font"| node_font
node_app -.->|"initializes runtime"| node_sdl
node_renderer -.->|"renders via"| node_sdl
node_input -.->|"reads events"| node_sdl

click node_main "https://github.com/mandliors/gaegebra/blob/main/src/main.c"
click node_app "https://github.com/mandliors/gaegebra/blob/main/src/app/app.c"
click node_window "https://github.com/mandliors/gaegebra/blob/main/src/window/window.c"
click node_input "https://github.com/mandliors/gaegebra/blob/main/src/input/input.c"
click node_coordinate "https://github.com/mandliors/gaegebra/blob/main/src/geometry/coordinate_system/coordinate_system.c"
click node_shapes "https://github.com/mandliors/gaegebra/blob/main/src/geometry/shape/shape.c"
click node_intersection "https://github.com/mandliors/gaegebra/blob/main/src/geometry/intersection/intersection.c"
click node_vectors2 "https://github.com/mandliors/gaegebra/blob/main/src/geometry/vector2/vector2.c"
click node_math "https://github.com/mandliors/gaegebra/blob/main/src/utils/math/math.c"
click node_ui "https://github.com/mandliors/gaegebra/blob/main/src/ui/ui.c"
click node_elements "https://github.com/mandliors/gaegebra/blob/main/src/ui/ui_element/ui_element.c"
click node_constraints "https://github.com/mandliors/gaegebra/blob/main/src/ui/ui_constraint/ui_constraint.c"
click node_renderer "https://github.com/mandliors/gaegebra/blob/main/src/renderer/renderer.c"
click node_texture "https://github.com/mandliors/gaegebra/blob/main/src/texture/texture.c"
click node_font "https://github.com/mandliors/gaegebra/blob/main/src/font/font.c"
click node_color "https://github.com/mandliors/gaegebra/blob/main/src/color/color.c"
click node_vector "https://github.com/mandliors/gaegebra/blob/main/src/utils/vector/vector.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_input,node_user toneBlue
class node_coordinate,node_shapes,node_intersection,node_vectors2,node_math toneAmber
class node_ui,node_elements,node_constraints toneMint
class node_app,node_window,node_renderer,node_texture,node_font,node_color,node_vector toneRose
class node_sdl toneIndigo
```

## Components

### App interaction

- [Application workflow](https://github.com/mandliors/gaegebra/blob/main/src/main.c): `src/main.c`
- [Input state](https://github.com/mandliors/gaegebra/blob/main/src/input/input.c): `src/input/input.c`

### Geometry

- [Coordinate plane](https://github.com/mandliors/gaegebra/blob/main/src/geometry/coordinate_system/coordinate_system.c): `src/geometry/coordinate_system/coordinate_system.c`
- [Geometry constructions](https://github.com/mandliors/gaegebra/blob/main/src/geometry/shape/shape.c): `src/geometry/shape/shape.c`
- [Intersection calculations](https://github.com/mandliors/gaegebra/blob/main/src/geometry/intersection/intersection.c): `src/geometry/intersection/intersection.c`
- [2D vector math](https://github.com/mandliors/gaegebra/blob/main/src/geometry/vector2/vector2.c): `src/geometry/vector2/vector2.c`
- [General math](https://github.com/mandliors/gaegebra/blob/main/src/utils/math/math.c): `src/utils/math/math.c`

### User interface

- [UI management](https://github.com/mandliors/gaegebra/blob/main/src/ui/ui.c): `src/ui/ui.c`
- [UI elements](https://github.com/mandliors/gaegebra/blob/main/src/ui/ui_element/ui_element.c): `src/ui/ui_element/ui_element.c`
- [Responsive constraints](https://github.com/mandliors/gaegebra/blob/main/src/ui/ui_constraint/ui_constraint.c): `src/ui/ui_constraint/ui_constraint.c`

### Window and rendering

- [App lifecycle](https://github.com/mandliors/gaegebra/blob/main/src/app/app.c): `src/app/app.c`
- [Window and events](https://github.com/mandliors/gaegebra/blob/main/src/window/window.c): `src/window/window.c`
- [Drawing renderer](https://github.com/mandliors/gaegebra/blob/main/src/renderer/renderer.c): `src/renderer/renderer.c`
- [Texture resources](https://github.com/mandliors/gaegebra/blob/main/src/texture/texture.c): `src/texture/texture.c`
- [Font resources](https://github.com/mandliors/gaegebra/blob/main/src/font/font.c): `src/font/font.c`
- [Color utilities](https://github.com/mandliors/gaegebra/blob/main/src/color/color.c): `src/color/color.c`
- [Dynamic collections](https://github.com/mandliors/gaegebra/blob/main/src/utils/vector/vector.c): `src/utils/vector/vector.c`

### Other components

- **User**
- **SDL2 runtime**

## Connections

- User → Application workflow: uses tools (evidence: `README.md`)
- Application workflow → App lifecycle: initializes (evidence: `src/main.c`)
- Application workflow → Window and events: creates window (evidence: `src/main.c`)
- Application workflow → UI management: builds interface (evidence: `src/main.c`)
- Application workflow → Coordinate plane: handles construction (evidence: `src/main.c`)
- Application workflow → Geometry constructions: creates shapes (evidence: `src/main.c`)
- App lifecycle → Window and events: manages windows (evidence: `src/app/app.c`)
- App lifecycle → Input state: updates input (evidence: `src/app/app.c`)
- App lifecycle → UI management: updates UI (evidence: `src/app/app.c`)
- Window and events → Input state: dispatches events (evidence: `src/window/window.c`)
- Window and events → UI management: updates and renders (evidence: `src/window/window.c`)
- Coordinate plane → Geometry constructions: stores shapes
- Coordinate plane → Drawing renderer: draws plane (evidence: `src/geometry/coordinate_system/coordinate_system.c`)
- Coordinate plane → Intersection calculations: uses calculations (evidence: `src/geometry/coordinate_system/coordinate_system.c`)
- Coordinate plane → General math: uses math (evidence: `src/geometry/coordinate_system/coordinate_system.c`)
- Geometry constructions → Coordinate plane: uses coordinate plane (evidence: `src/geometry/shape/shape.c`)
- Geometry constructions → Drawing renderer: draws geometry (evidence: `src/geometry/shape/shape.c`)
- Geometry constructions → Input state: reads interaction (evidence: `src/geometry/shape/shape.c`)
- Intersection calculations → Geometry constructions: operates on shapes
- UI management → UI elements: manages elements
- UI elements → Responsive constraints: uses constraints
- UI elements → Drawing renderer: draws controls (evidence: `src/ui/ui_element/ui_element.c`)
- UI elements → Input state: handles interaction (evidence: `src/ui/ui_element/ui_element.c`)
- Drawing renderer → Texture resources: draws textures (evidence: `src/renderer/renderer.c`)
- Drawing renderer → Font resources: draws text (evidence: `src/renderer/renderer.c`)
- Application workflow → Font resources: loads font (evidence: `src/main.c`)
- App lifecycle → SDL2 runtime: initializes runtime
- Drawing renderer → SDL2 runtime: renders via
- Input state → SDL2 runtime: reads events
