# notgiven688/jitterphysics2 architecture

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

## Overview

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

a) Core Physics Engine (Jitter2)
- Collision System
- Dynamics System
- Linear Math
- Soft Bodies
- World Management

b) Integration Components
- Demo Applications
- Benchmarking System
- Testing Framework

##### Detailed Architecture Breakdown

Layer 1 (Core):
- Jitter2 Core Engine ---------------------+

- Collision |  | Dynamics  |  | SoftBodies |  | Linear  |  |
- System    |<->| System    |<->| System     |  | Math    |  |

- ^                                     |

- World   |                                |
- Manager  |                                |

Layer 2 (Integration):
- Integration Layer ----------------------+

- JitterDemo|  | Benchmarks  |  | Unit Tests |          |
- (OpenGL)  |  |             |  |            |          |

##### Key Components to Highlight

a) Collision System:
- DynamicTree for broad-phase collision detection
- NarrowPhase for detailed collision detection

b) Dynamics System:
- Constraints and joints
- Contact resolution
- Rigid body simulation

c) World Management:
- Physics step management
- Object lifecycle
- Parallelization support

##### Important Relationships

- Data flow between collision detection and dynamics
- How the World manager coordinates all systems
- Demonstrate integration points with external frameworks (Godot, Web)

##### Implementation Details

- Diamonds for composition relationships

##### Additional Elements

- Component types
- Relationship types
- Version information
- Platform support indicators

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Jitter2 Core Engine"]
        direction TB
        
        World["World Manager"]:::core
        click World "https://github.com/notgiven688/jitterphysics2/blob/main/src/Jitter2/World.cs"
        
        subgraph Physics["Physics Systems"]
            direction TB
            
            Collision["Collision System"]:::physics
            click Collision "https://github.com/notgiven688/jitterphysics2/tree/main/src/Jitter2/Collision/"
            
            Dynamics["Dynamics System"]:::physics
            click Dynamics "https://github.com/notgiven688/jitterphysics2/tree/main/src/Jitter2/Dynamics/"
            
            SoftBodies["Soft Bodies System"]:::physics
            click SoftBodies "https://github.com/notgiven688/jitterphysics2/tree/main/src/Jitter2/SoftBodies/"
            
            LinearMath["Linear Math System"]:::math
            click LinearMath "https://github.com/notgiven688/jitterphysics2/tree/main/src/Jitter2/LinearMath/"
            
            subgraph CollisionComponents["Collision Components"]
                BroadPhase["Dynamic Tree<br/>(Broad Phase)"]:::collision
                click BroadPhase "https://github.com/notgiven688/jitterphysics2/blob/main/src/Jitter2/Collision/DynamicTree.cs"
                
                NarrowPhase["Narrow Phase"]:::collision
                click NarrowPhase "https://github.com/notgiven688/jitterphysics2/tree/main/src/Jitter2/Collision/NarrowPhase/"
                
                Shapes["Shape Implementations"]:::collision
                click Shapes "https://github.com/notgiven688/jitterphysics2/tree/main/src/Jitter2/Collision/Shapes/"
            end
            
            subgraph DynamicsComponents["Dynamics Components"]
                RigidBody["Rigid Body"]:::dynamics
                click RigidBody "https://github.com/notgiven688/jitterphysics2/blob/main/src/Jitter2/Dynamics/RigidBody.cs"
                
                Constraints["Constraints"]:::dynamics
                click Constraints "https://github.com/notgiven688/jitterphysics2/tree/main/src/Jitter2/Dynamics/Constraints/"
                
                Joints["Joints"]:::dynamics
                click Joints "https://github.com/notgiven688/jitterphysics2/tree/main/src/Jitter2/Dynamics/Joints/"
            end
            
            subgraph MathComponents["Math Components"]
                JMatrix["JMatrix"]:::math
                click JMatrix "https://github.com/notgiven688/jitterphysics2/blob/main/src/Jitter2/LinearMath/JMatrix.cs"
                
                JVector["JVector"]:::math
                click JVector "https://github.com/notgiven688/jitterphysics2/blob/main/src/Jitter2/LinearMath/JVector.cs"
                
                MathHelper["Math Helper"]:::math
                click MathHelper "https://github.com/notgiven688/jitterphysics2/blob/main/src/Jitter2/LinearMath/MathHelper.cs"
            end
            
            subgraph SoftBodyComponents["Soft Body Components"]
                SoftBody["Soft Body"]:::softbody
                click SoftBody "https://github.com/notgiven688/jitterphysics2/blob/main/src/Jitter2/SoftBodies/SoftBody.cs"
                
                Springs["Spring Constraints"]:::softbody
                click Springs "https://github.com/notgiven688/jitterphysics2/blob/main/src/Jitter2/SoftBodies/SpringConstraint.cs"
            end
        end
    end
    
    subgraph Integration["Integration Layer"]
        direction TB
        
        Demo["JitterDemo<br/>(OpenGL)"]:::integration
        click Demo "https://github.com/notgiven688/jitterphysics2/tree/main/src/JitterDemo/"
        
        Benchmark["Benchmarking<br/>System"]:::integration
        click Benchmark "https://github.com/notgiven688/jitterphysics2/tree/main/src/JitterBenchmark/"
        
        Tests["Unit Tests"]:::integration
        click Tests "https://github.com/notgiven688/jitterphysics2/tree/main/src/JitterTests/"
        
        subgraph External["External Integration"]
            Godot["Godot Demo"]:::external
            click Godot "https://github.com/notgiven688/jitterphysics2/tree/main/other/GodotDemo/"
            
            Web["Web Demo"]:::external
            click Web "https://github.com/notgiven688/jitterphysics2/tree/main/other/WebDemo/"
        end
    end
    
    %% Relationships
    World --> Collision
    World --> Dynamics
    World --> SoftBodies
    
    Collision --> CollisionComponents
    BroadPhase --> NarrowPhase
    NarrowPhase --> Shapes
    
    Dynamics --> DynamicsComponents
    RigidBody --> Constraints
    RigidBody --> Joints
    
    LinearMath --> MathComponents
    
    SoftBodies --> SoftBodyComponents
    SoftBody --> Springs
    
    Integration --> Core
    External --> Core
    
    %% Styling
    classDef core fill:#2d5c8a,stroke:#1a365d,color:white
    classDef physics fill:#4a90e2,stroke:#2171c7,color:white
    classDef collision fill:#3498db,stroke:#2980b9,color:white
    classDef dynamics fill:#2ecc71,stroke:#27ae60,color:white
    classDef math fill:#f1c40f,stroke:#f39c12,color:black
    classDef softbody fill:#e74c3c,stroke:#c0392b,color:white
    classDef integration fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef external fill:#8e44ad,stroke:#6c3483,color:white
```
