# caimeox/voxelgeometry architecture

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

## Overview

##### Main Components

a) Core Library Components:
- Vector Engine (vector.ts)
- Geometry Generators
- Transformation System
- Mathematical Interpreters
- Specialized Algorithms (DLA, IFS)

b) Integration Layer:
- Canvas Renderer
- Web Viewer
- Minecraft Integration Points (mentioned in branches)

**┌─────────────────────────────────────────────┐**
- Client Applications            │
- (Web Viewer, Minecraft, Custom Solutions)  │
- ┘
- ↑
**┌─────────────────────────────────────────────┐**
- Integration Layer                │
- (Canvas API, Rendering Systems)         │
- ┘
- ↑
**┌─────────────────────────────────────────────┐**
- Core Components                │
- ┬─────────────┬────────────────┤
- Geometry   │ Transform-  │   Algorithm    │
- Engine     │   ation     │    Engine      │
- ┴─────────────┴────────────────┘

##### Component Details

a) Geometry Engine (Blue Rectangle):
- Vector Operations (vector.ts)
- L-System Implementation (lsystem.ts)
- Turtle Graphics (turtle.ts)

b) Transformation Engine (Green Rectangle):
- Space Transformations (transform.ts)
- Expression Evaluation (expression.ts)
- Utility Functions (utils.ts)

c) Algorithm Engine (Purple Rectangle):
- DLA Implementation (DLA2D.ts, DLA3D.ts)
- IFS Implementation (ifs.ts)
- Hyper Geometric Operations (hyper.ts)

**□ Core Components**
**◇ Integration Layers**
**○ Client Applications**

**Blue: Geometry Operations**
**Green: Transformations**
**Purple: Advanced Algorithms**
**Gray: Integration Components**

##### Additional Notes

- Clear separation between pure mathematical operations and rendering systems
- Modular nature of the transformation system
- Extension points for different platforms (Minecraft, Web)
- Version/build pipeline information from GitHub workflows

Remember to include notes about the asynchronous nature of certain operations (like DLA and IFS) and how they integrate with the synchronous geometric operations.

This structure will give a clear understanding of how the library processes voxel geometry from mathematical concepts through to final rendering, while maintaining clarity about the separation of concerns between core mathematical operations and platform-specific implementations.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef core fill:#e1f5fe,stroke:#01579b
    classDef integration fill:#f3e5f5,stroke:#4a148c
    classDef client fill:#e8f5e9,stroke:#1b5e20
    classDef algorithm fill:#fff3e0,stroke:#e65100

    %% Client Layer
    subgraph ClientLayer
        WebViewer["Web Viewer"]
        Minecraft["Minecraft Integration"]
        CustomSolutions["Custom Solutions"]
    end

    %% Integration Layer
    subgraph IntegrationLayer
        CanvasRenderer["Canvas Renderer"]
        RenderingSystems["Rendering Systems"]
    end

    %% Core Components
    subgraph CoreComponents
        %% Geometry Engine
        subgraph GeometryEngine
            VectorEngine["Vector Engine"]:::core
            GeometryGen["Geometry Generator"]:::core
            LSystem["L-System"]:::core
            TurtleGraphics["Turtle Graphics"]:::core
        end

        %% Transformation Engine
        subgraph TransformEngine
            Transform["Transformation System"]:::core
            ExpressionEval["Expression Evaluator"]:::core
            Utils["Utility Functions"]:::core
        end

        %% Algorithm Engine
        subgraph AlgorithmEngine
            DLA["DLA Implementation"]:::algorithm
            IFS["IFS Implementation"]:::algorithm
            HyperOps["Hyper Geometric Ops"]:::algorithm
            LineAmp["Line Amplification"]:::algorithm
        end
    end

    %% Relationships
    GeometryEngine --> IntegrationLayer
    TransformEngine --> IntegrationLayer
    AlgorithmEngine --> IntegrationLayer
    IntegrationLayer --> ClientLayer

    %% Internal Relationships
    VectorEngine --> Transform
    GeometryGen --> Transform
    Transform --> DLA
    Transform --> IFS
    ExpressionEval --> Transform
    Utils --> Transform
    Utils --> GeometryGen

    %% Click Events
    click VectorEngine "https://github.com/caimeox/voxelgeometry/blob/core/src/vector.ts"
    click GeometryGen "https://github.com/caimeox/voxelgeometry/blob/core/src/generator.ts"
    click Transform "https://github.com/caimeox/voxelgeometry/blob/core/src/transform.ts"
    click ExpressionEval "https://github.com/caimeox/voxelgeometry/blob/core/src/expression.ts"
    click DLA "https://github.com/caimeox/voxelgeometry/blob/core/src/DLA2D.ts"
    click IFS "https://github.com/caimeox/voxelgeometry/blob/core/src/ifs.ts"
    click LSystem "https://github.com/caimeox/voxelgeometry/blob/core/src/lsystem.ts"
    click TurtleGraphics "https://github.com/caimeox/voxelgeometry/blob/core/src/turtle.ts"
    click HyperOps "https://github.com/caimeox/voxelgeometry/blob/core/src/hyper.ts"
    click CanvasRenderer "https://github.com/caimeox/voxelgeometry/blob/core/src/canvas.ts"
    click WebViewer "https://github.com/caimeox/voxelgeometry/tree/core/webviewer/"
    click LineAmp "https://github.com/caimeox/voxelgeometry/blob/core/src/lineamp.ts"
    click Utils "https://github.com/caimeox/voxelgeometry/blob/core/src/utils.ts"

    %% Legend
    subgraph Legend
        CoreComp["Core Component"]:::core
        IntegrationComp["Integration Component"]:::integration
        ClientComp["Client Component"]:::client
        AlgorithmComp["Algorithm Component"]:::algorithm
    end
```
