# vihdzp/miratope-rs architecture

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

- Interactive diagram: https://gitdiagram.com/vihdzp/miratope-rs
- Repository: https://github.com/vihdzp/miratope-rs

## Overview

##### Main Components
The system should be divided into these key components:

a) Core Engine (miratope-core):
- Abstract Polytope System (abs/)
- Concrete Polytope System (conc/)
- Coxeter Groups Handler (cox/)
- File Operations (file/)
- Geometry Engine
- Theory Implementation (group/)

b) Frontend/UI Layer:
- Main Window System
- Camera Controls
- Configuration Management
- Library Browser
- Right Panel Interface
- Top Panel Interface
- Wiki Integration

c) Rendering Pipeline:
- No-Cull Pipeline
- Mesh System
- Shader Management (GLSL)

d) Resource Management:
- Polytope Library (.off files)
- Memory Management

**[User Interface Layer]**
- ↕
**[Rendering Layer]**
- ↕
**[Core Engine Layer]**
- ↕
**[Resource Layer]**

##### Component Relationships

Key interactions:
- UI → Rendering Pipeline: Display requests
- UI → Core Engine: Polytope operations
- Core Engine → Resource Layer: Library access
- Rendering Pipeline → Core Engine: Geometry data
- Core Engine ↔ File System: Import/export operations

##### Implementation Details

Technical aspects:
- Rust as primary language
- WGPU for graphics
- Custom shader implementation
- File format parsers
- Mathematical operations

##### External Dependencies

Connections to:
- Rust ecosystem
- Graphics libraries
- Math libraries
- File system

This architecture reflects both the mathematical complexity of polytope operations and the need for efficient visualization, while maintaining a modular structure that allows for future extensions and modifications.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef render fill:#e67e22,stroke:#d35400,color:white
    classDef resource fill:#9b59b6,stroke:#8e44ad,color:white
    classDef system fill:#e74c3c,stroke:#c0392b,color:white

    %% UI Layer
    subgraph UI
        MW["Main Window System"]
        CC["Camera Controls"]
        CM["Configuration Management"]
        LB["Library Browser"]
        RP["Right Panel Interface"]
        TP["Top Panel Interface"]
        WI["Wiki Integration"]
        MM["Memory Management"]
    end

    %% Rendering Layer
    subgraph Rendering
        NCP["No-Cull Pipeline"]
        MS["Mesh System"]
        SM["Shader Management"]
    end

    %% Core Engine Layer
    subgraph CoreEngine
        APS["Abstract Polytope System"]
        CPS["Concrete Polytope System"]
        CGH["Coxeter Groups Handler"]
        FO["File Operations"]
        GE["Geometry Engine"]
        GTI["Group Theory Implementation"]
    end

    %% Resource Layer
    subgraph Resources
        AS["Asset System"]
        PL["Polytope Library"]
        FS["File System"]
    end

    %% Relationships
    UI --> Rendering
    UI --> CoreEngine
    Rendering --> CoreEngine
    CoreEngine --> Resources
    Resources --> CoreEngine

    %% Component Classes
    class MW,CC,CM,LB,RP,TP,WI,MM ui
    class APS,CPS,CGH,FO,GE,GTI core
    class NCP,MS,SM render
    class AS,PL,FS resource

    %% Click Events
    click MW "https://github.com/vihdzp/miratope-rs/blob/main/src/ui/main_window.rs"
    click CC "https://github.com/vihdzp/miratope-rs/blob/main/src/ui/camera.rs"
    click CM "https://github.com/vihdzp/miratope-rs/blob/main/src/ui/config.rs"
    click LB "https://github.com/vihdzp/miratope-rs/tree/main/src/ui/library/"
    click RP "https://github.com/vihdzp/miratope-rs/blob/main/src/ui/right_panel.rs"
    click TP "https://github.com/vihdzp/miratope-rs/blob/main/src/ui/top_panel.rs"
    click WI "https://github.com/vihdzp/miratope-rs/blob/main/src/ui/wiki.rs"
    click MM "https://github.com/vihdzp/miratope-rs/blob/main/src/ui/memory.rs"
    click NCP "https://github.com/vihdzp/miratope-rs/tree/main/src/no_cull_pipeline/"
    click MS "https://github.com/vihdzp/miratope-rs/blob/main/src/mesh.rs"
    click APS "https://github.com/vihdzp/miratope-rs/tree/main/miratope-core/src/abs/"
    click CPS "https://github.com/vihdzp/miratope-rs/tree/main/miratope-core/src/conc/"
    click CGH "https://github.com/vihdzp/miratope-rs/tree/main/miratope-core/src/cox/"
    click FO "https://github.com/vihdzp/miratope-rs/tree/main/miratope-core/src/file/"
    click GE "https://github.com/vihdzp/miratope-rs/blob/main/miratope-core/src/geometry.rs"
    click GTI "https://github.com/vihdzp/miratope-rs/tree/main/miratope-core/src/group/"
    click AS "https://github.com/vihdzp/miratope-rs/tree/main/assets/"
    click PL "https://github.com/vihdzp/miratope-rs/tree/main/lib/"

    %% Legend
    subgraph Legend
        UI_L["UI Components"]:::ui
        CORE_L["Core Components"]:::core
        RENDER_L["Rendering Components"]:::render
        RESOURCE_L["Resource Components"]:::resource
    end
```
