# ryfn638/shapegeometrise architecture

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

- Interactive diagram: https://gitdiagram.com/ryfn638/shapegeometrise
- Repository: https://github.com/ryfn638/shapegeometrise

## Overview

Geometrise is a desktop image-approximation tool: a user chooses a target image and generation settings, starts or stops a run, and views the evolving canvas and diagnostics. Generation creates and mutates shape candidates, scores them with the CPU grader or CUDA batch grader, then projects selected shapes onto the canvas. Masks supply shape geometry; the renderer presents the canvas through a Win32/DirectX 11 and Dear ImGui interface. The README documents these capabilities; some internal connections are supported only by its architecture description or module references, not sampled call sites.

Main entry points: [`ImageGeometrise/src/igGeneration.cpp`](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igGeneration.cpp) (Generation Manager), [`ImageGeometrise/src/UI/igWindowUI.cpp`](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/UI/igWindowUI.cpp) (UI Controls), [`ImageGeometrise/src/igShape.cpp`](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igShape.cpp) (Shape Transform), [`ImageGeometrise/src/igCanvas.cpp`](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igCanvas.cpp) (Canvas and Image Load)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["Application Entry<br/>[main.cpp]"]
end

subgraph group_generation["Shape Generation"]
  node_generation_mgr["Generation Manager<br/>[igGeneration.cpp]"]
  node_shape["Shape Transform<br/>[igShape.cpp]"]
  node_mask["Shape Mask<br/>[igMask.cpp]"]
end

subgraph group_canvas["Canvas and Scoring"]
  node_canvas_data["Canvas and Image Load<br/>[igCanvas.cpp]"]
  node_cpu_grader["CPU Grader<br/>[igCanvasGrader.cpp]"]
  node_cuda_grader["CUDA Batch Grader"]
  node_common["Colour and Vectors<br/>[igCommon.cpp]"]
end

subgraph group_interface["Desktop Interface"]
  node_window["Win32 Window<br/>[igWindow.cpp]"]
  node_controls["UI Controls<br/>[igWindowUI.cpp]"]
  node_imgui["Dear ImGui"]
  node_renderer["Canvas Renderer"]
end

node_user(("User"))
node_target["Target Image"]

node_user -->|"sets options"| node_controls
node_controls -->|"opens image"| node_window
node_target -->|"loads target"| node_canvas_data
node_controls -->|"starts or stops"| node_generation_mgr
node_controls -->|"builds panels"| node_imgui
node_main -->|"creates and polls"| node_window
node_main -->|"creates and resizes"| node_renderer
node_main -->|"renders frames"| node_controls
node_controls -->|"draws canvas"| node_renderer
node_generation_mgr -->|"loads and resizes"| node_canvas_data
node_generation_mgr -->|"creates candidates"| node_shape
node_generation_mgr -->|"selects masks"| node_mask
node_shape -->|"samples pixels"| node_mask
node_generation_mgr -->|"scores on CPU"| node_cpu_grader
node_generation_mgr -->|"scores on GPU"| node_cuda_grader
node_cpu_grader -->|"scores against"| node_canvas_data
node_cpu_grader -->|"grades shape"| node_shape
node_cuda_grader -->|"grades shape"| node_shape
node_generation_mgr -->|"projects selected shape"| node_renderer
node_renderer -->|"owns displayed canvas"| node_canvas_data
node_canvas_data -->|"projects shape"| node_shape
node_shape -->|"uses colour and vectors"| node_common
node_mask -->|"uses shared types"| node_common

click node_main "https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/main.cpp"
click node_window "https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/UI/igWindow.cpp"
click node_controls "https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/UI/igWindowUI.cpp"
click node_imgui "https://github.com/ryfn638/shapegeometrise/tree/master/ImageGeometrise/3rdParty/imgui"
click node_renderer "https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/UI/igCanvasRenderer.cpp"
click node_generation_mgr "https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igGeneration.cpp"
click node_shape "https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igShape.cpp"
click node_mask "https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igMask.cpp"
click node_canvas_data "https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igCanvas.cpp"
click node_cpu_grader "https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igCanvasGrader.cpp"
click node_cuda_grader "https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/CUDA/igGenerationBatch.cu"
click node_common "https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igCommon.cpp"

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_user toneBlue
class node_generation_mgr,node_shape,node_mask toneAmber
class node_canvas_data,node_cpu_grader,node_cuda_grader,node_common toneMint
class node_window,node_controls,node_imgui,node_renderer toneRose
class node_target toneIndigo
```

## Components

### Application

- [Application Entry](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/main.cpp): `ImageGeometrise/src/main.cpp`

### Shape Generation

- [Generation Manager](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igGeneration.cpp): `ImageGeometrise/src/igGeneration.cpp`
- [Shape Transform](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igShape.cpp): `ImageGeometrise/src/igShape.cpp`
- [Shape Mask](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igMask.cpp): `ImageGeometrise/src/igMask.cpp`

### Canvas and Scoring

- [Canvas and Image Load](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igCanvas.cpp): `ImageGeometrise/src/igCanvas.cpp`
- [CPU Grader](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igCanvasGrader.cpp): `ImageGeometrise/src/igCanvasGrader.cpp`
- [CUDA Batch Grader](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/CUDA/igGenerationBatch.cu): `ImageGeometrise/src/CUDA/igGenerationBatch.cu`
- [Colour and Vectors](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/igCommon.cpp): `ImageGeometrise/src/igCommon.cpp`

### Desktop Interface

- [Win32 Window](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/UI/igWindow.cpp): `ImageGeometrise/src/UI/igWindow.cpp`
- [UI Controls](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/UI/igWindowUI.cpp): `ImageGeometrise/src/UI/igWindowUI.cpp`
- [Dear ImGui](https://github.com/ryfn638/shapegeometrise/tree/master/ImageGeometrise/3rdParty/imgui): `ImageGeometrise/3rdParty/imgui`
- [Canvas Renderer](https://github.com/ryfn638/shapegeometrise/blob/master/ImageGeometrise/src/UI/igCanvasRenderer.cpp): `ImageGeometrise/src/UI/igCanvasRenderer.cpp`

### Other components

- **User**
- **Target Image**

## Connections

- User → UI Controls: sets options (evidence: `README.md`)
- UI Controls → Win32 Window: opens image (evidence: `README.md`)
- Target Image → Canvas and Image Load: loads target (evidence: `README.md`)
- UI Controls → Generation Manager: starts or stops
- UI Controls → Dear ImGui: builds panels (evidence: `ImageGeometrise/src/UI/igWindowUI.cpp`)
- Application Entry → Win32 Window: creates and polls (evidence: `ImageGeometrise/src/main.cpp`)
- Application Entry → Canvas Renderer: creates and resizes (evidence: `ImageGeometrise/src/main.cpp`)
- Application Entry → UI Controls: renders frames (evidence: `ImageGeometrise/src/main.cpp`)
- UI Controls → Canvas Renderer: draws canvas
- Generation Manager → Canvas and Image Load: loads and resizes (evidence: `README.md`)
- Generation Manager → Shape Transform: creates candidates (evidence: `README.md`)
- Generation Manager → Shape Mask: selects masks
- Shape Transform → Shape Mask: samples pixels
- Generation Manager → CPU Grader: scores on CPU (evidence: `README.md`)
- Generation Manager → CUDA Batch Grader: scores on GPU (evidence: `README.md`)
- CPU Grader → Canvas and Image Load: scores against
- CPU Grader → Shape Transform: grades shape
- CUDA Batch Grader → Shape Transform: grades shape (evidence: `README.md`)
- Generation Manager → Canvas Renderer: projects selected shape (evidence: `README.md`)
- Canvas Renderer → Canvas and Image Load: owns displayed canvas
- Canvas and Image Load → Shape Transform: projects shape (evidence: `ImageGeometrise/src/igCanvas.cpp`)
- Shape Transform → Colour and Vectors: uses colour and vectors
- Shape Mask → Colour and Vectors: uses shared types
