# afhverjuekki/tolvera architecture

> Architecture diagram of the GitHub repository afhverjuekki/tolvera, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/afhverjuekki/tolvera
- Repository: https://github.com/afhverjuekki/tolvera

## Overview

##### Main Components

a. Core System Components:
- Tolvera Core Engine (based on Taichi)
- Behavior Modules (under vera/)
- Input/Output Systems
- Integration Interfaces

b. Key Subsystems:
- MediaPipe Integration (mp/)
- OSC Communication (osc/)
- Interactive Machine Learning (iml)
- Hardware Interface (dualsense)

**Top Layer: External Interfaces**

**Middle Layer: Core Processing**

**Bottom Layer: Behavior Implementation**

##### Component Relationships

a. External Communication:
- OSC interfaces (MaxMSP, Pure Data)
- Hardware controllers
- MediaPipe inputs (face, hands, pose tracking)
- Machine Learning interfaces

b. Core Processing:
- Context management
- State handling
- Particle system
- Pixel processing

c. Behavior Implementation:
- Flocking
- Slime mold
- Particle life
- Reaction diffusion
- Swarmalators

##### Specific Implementation Details

- Taichi integration for parallelization
- Real-time processing capabilities
- Modular behavior system
- Interactive control mechanisms

##### Data Flow Representation

Show:
- Input data streams from sensors/controllers
- Behavior processing pipeline
- Output rendering and communication
- State management flow
- OSC message routing

##### Integration Points

Emphasize:
- OSC communication endpoints
- MediaPipe integration
- Machine learning interface
- Hardware controller support

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style Definitions
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef behavior fill:#9b59b6,stroke:#8e44ad,color:white
    classDef input fill:#2ecc71,stroke:#27ae60,color:white
    classDef output fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    %% External Interfaces Layer
    subgraph ExternalLayer["External Interfaces"]
        OSC["OSC Communication"]:::input
        MaxMSP["MaxMSP Integration"]:::external
        PureData["Pure Data Integration"]:::external
        Hardware["Hardware Controller"]:::input
        MP["MediaPipe Integration"]:::input
        IML["Interactive ML"]:::input
    end

    %% Core Processing Layer
    subgraph CoreLayer["Core Processing"]
        CoreEngine["Core Engine"]:::core
        Context["Context Management"]:::core
        State["State Handling"]:::core
        Particles["Particle System"]:::core
        Pixels["Pixel Processing"]:::core
    end

    %% Behavior Layer
    subgraph BehaviorLayer["Behavior Implementation"]
        Flock["Flocking"]:::behavior
        Slime["Slime Mold"]:::behavior
        PLife["Particle Life"]:::behavior
        RD["Reaction Diffusion"]:::behavior
        Swarm["Swarmalators"]:::behavior
    end

    %% MediaPipe Components
    subgraph MPComponents["MediaPipe Components"]
        Face["Face Tracking"]:::input
        Hands["Hand Tracking"]:::input
        Pose["Pose Tracking"]:::input
        FaceMesh["Face Mesh"]:::input
    end

    %% Additional Systems
    subgraph AddSystems["Additional Systems"]
        CV["Computer Vision"]:::core
        Rec["Recording System"]:::output
    end

    %% Connections
    MP --> |Input| MPComponents
    MPComponents --> CoreEngine
    OSC --> |Communication| CoreEngine
    MaxMSP --> OSC
    PureData --> OSC
    Hardware --> CoreEngine
    IML --> CoreEngine

    CoreEngine --> Context
    CoreEngine --> State
    CoreEngine --> Particles
    CoreEngine --> Pixels

    Context --> BehaviorLayer
    State --> BehaviorLayer
    Particles --> BehaviorLayer
    Pixels --> BehaviorLayer

    BehaviorLayer --> CV
    BehaviorLayer --> Rec

    %% Click Events
    click CoreEngine "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/taichi_.py"
    click Context "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/context.py"
    click State "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/state.py"
    click Particles "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/particles.py"
    click Pixels "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/pixels.py"
    click Flock "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/vera/flock.py"
    click Slime "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/vera/slime.py"
    click PLife "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/vera/particle_life.py"
    click RD "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/vera/reaction_diffusion.py"
    click Swarm "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/vera/swarmalators.py"
    click OSC "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/osc/osc.py"
    click MaxMSP "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/osc/maxmsp.py"
    click PureData "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/osc/pd.py"
    click Hardware "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/dualsense.py"
    click Face "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/mp/face.py"
    click Hands "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/mp/hands.py"
    click Pose "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/mp/pose.py"
    click FaceMesh "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/mp/face_mesh.py"
    click IML "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/iml.py"
    click CV "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/cv.py"
    click Rec "https://github.com/afhverjuekki/tolvera/blob/main/src/tolvera/rec.py"
```
