# amanbohra7/bioarsdk architecture

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

- Interactive diagram: https://gitdiagram.com/amanbohra7/bioarsdk
- Repository: https://github.com/amanbohra7/bioarsdk

## Overview

##### Main Components
- Unity Engine Core: This is implicit since the project is a Unity project. Denote the Unity Engine as the underlying runtime.
- AR & Camera Components: Illustrate the AR components such as phone camera scripts (e.g., PhoneCamera.cs in ElectronDetections) and AR view controllers, which capture and process camera input, and integrate with ARCore (noting the presence of ARCoreProjectSettings.json).
- Model Generation and 3D Assets: Represent a component responsible for generating or modifying 3D models (see ModelGenerator scripts and assets like Fbx and Structures directories). These components likely handle model creation and modification during runtime.
- UI & Interaction Controllers: Include UI panels and controllers (e.g., ARviewUI.cs, EPanel.cs, and various UI folders) that manage user interactions.
- Data and Configuration: There are directories for DATA and JSON files (the PeriodicTableJson folder) indicating that the app loads and parses data—perhaps from a periodic table or similar biomolecular data.
- External/Third-Party Libraries: List LeanTween, JsonDotNet, OpenCVForUnity, and ExternalDependencyManager as key external dependencies that provide functionalities like smooth transitions, JSON serialization, and computer vision.

##### Relationships and Interactions
- The AR scenes communicate with the Unity Engine’s core rendering and input system.
- The UI Components receive input from the user and interact with scene controllers that coordinate the AR camera’s input, model generation, and visualization.
- The Model Generator component takes data (from assets or external sources like the JSON files) and dynamically constructs or alters 3D models.

##### Architectural Patterns and Design Principles
- Modular Separation: The project is broken into logical directories – Scripts, Scenes, Assets, Prefabs – implying a modular approach.
- MVC-like Separation: Though a strict MVC may not be implemented, the separation between “view” (scenes, UI prefabs), “controller” (various script controllers), and “model” (data, assets, external libraries) is evident.
- Use of External Dependencies for Clear Separation: The integration of third-party libraries is encapsulated in their directories (LeanTween, JsonDotNet, ExternalDependencyManager) indicating a plugin-based or component-based architecture.

##### Relevant Technologies and Frameworks
- Unity 3D Engine as the core runtime
- ARCore integration (via the ARCoreProjectSettings.json)
- LeanTween for tween animations
- JsonDotNet for JSON parsing
- ExternalDependencyManager for handling library dependencies
- OpenCVForUnity for image processing within AR features

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Level: Unity Engine Core
    UnityCore["Unity Engine Core"]:::unity

    %% Subgraph: AR Scenes and Views
    subgraph "AR Scenes and Views"
        ARVIEW["AR_VIEW Scene"]:::scene
        ElectronDetectionScene["ElectronDetection Scene"]:::scene
        ProteinViewScene["ProteinView Scene"]:::scene
        ModelGeneratorScene["ModelGenerator Scene"]:::scene
    end

    %% Subgraph: AR & Camera Components
    subgraph "AR & Camera Components"
        PhoneCamera["Phone Camera/Input Handler"]:::arcamera
        ARViewController["AR View Controller"]:::arcamera
    end

    %% Subgraph: Model Generation and 3D Assets
    subgraph "Model Generation and 3D Assets"
        ModelGenLogic["Model Generation Logic"]:::model
        ModelModification["Model Modification"]:::model
        FBXAssets["FBX Assets"]:::model
        StructuresAssets["Structures Assets"]:::model
        ModelPrefab["Model Generator Prefab"]:::model
    end

    %% Subgraph: UI & Interaction Controllers
    subgraph "UI & Interaction Controllers"
        ARviewUI["ARviewUI"]:::ui
        EPanel["EPanel"]:::ui
        ElectronDetectionUI["ElectronDetectionUI Manager"]:::ui
        ModelGenUI["Model Generator UI"]:::ui
    end

    %% Subgraph: Data and Configuration
    subgraph "Data and Configuration"
        PeriodicTableData["Periodic Table JSON Data"]:::data
        StreamingData["Streaming Data File"]:::data
        ARCoreSettings["ARCore Settings"]:::data
    end

    %% Subgraph: External/Third-Party Libraries
    subgraph "External Libraries"
        LeanTween["LeanTween"]:::external
        JsonDotNet["JsonDotNet"]:::external
        ExternalDepManager["ExternalDependencyManager"]:::external
        OpenCVForUnity["OpenCVForUnity"]:::external
    end

    %% Connections from Unity Engine Core to major components
    UnityCore -->|"supports"| ARVIEW
    UnityCore -->|"supports"| ElectronDetectionScene
    UnityCore -->|"supports"| ProteinViewScene
    UnityCore -->|"supports"| ModelGeneratorScene
    UnityCore -->|"integrates"| PhoneCamera
    UnityCore -->|"integrates"| ARViewController
    UnityCore -->|"integrates"| ModelGenLogic
    UnityCore -->|"integrates"| ARviewUI
    UnityCore -->|"integrates"| PeriodicTableData
    UnityCore -->|"integrates"| LeanTween
    UnityCore -->|"integrates"| ExternalDepManager

    %% AR Scenes interactions
    ARVIEW -->|"controlledBy"| ARViewController
    ElectronDetectionScene -->|"uses"| PhoneCamera
    ElectronDetectionScene -->|"triggers"| ElectronDetectionUI
    ModelGeneratorScene -->|"launches"| ModelGenLogic
    ModelGeneratorScene -->|"launches"| ModelGenUI

    %% AR & Camera Dependencies
    PhoneCamera -->|"processes"| OpenCVForUnity
    ARViewController -->|"receives config"| ARCoreSettings

    %% Model Generation processing
    ModelGenLogic -->|"calls"| ModelModification
    ModelGenLogic -->|"loads"| FBXAssets
    ModelGenLogic -->|"loads"| StructuresAssets
    ModelGenLogic -->|"instantiates"| ModelPrefab
    PeriodicTableData -->|"feeds data"| ModelGenLogic
    StreamingData -->|"feeds data"| ModelGenLogic
    ModelGenLogic -->|"parses"| JsonDotNet

    %% UI interactions and external libraries
    ARviewUI -->|"animates with"| LeanTween
    EPanel -->|"animates with"| LeanTween
    ARviewUI -->|"coordinates with"| ModelGenUI
    ElectronDetectionUI -->|"cooperates with"| PhoneCamera

    %% External Dependency Manager usage
    ModelGenLogic -->|"manages deps"| ExternalDepManager
    ARViewController -->|"manages deps"| ExternalDepManager

    %% Styles
    classDef unity fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef scene fill:#A9DFBF,stroke:#1E8449,stroke-width:2px;
    classDef arcamera fill:#F9E79F,stroke:#D4AC0D,stroke-width:2px;
    classDef model fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef ui fill:#D2B4DE,stroke:#7D3C98,stroke-width:2px;
    classDef data fill:#FAD7A0,stroke:#D68910,stroke-width:2px;
    classDef external fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;

    %% Click Events - AR Scenes
    click ARVIEW "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/Scenes/AR_VIEW.unity"
    click ElectronDetectionScene "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/Scenes/ElectronDetection.unity"
    click ProteinViewScene "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/Scenes/ProteinView.unity"
    click ModelGeneratorScene "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/Scenes/ModelGenerator.unity"

    %% Click Events - AR & Camera Components
    click PhoneCamera "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/Scripts/ElectronDetections/PhoneCamera.cs"
    click ARViewController "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/Scripts/AR_VIEW/ViewARController.cs"

    %% Click Events - Model Generation and 3D Assets
    click ModelGenLogic "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/Scripts/ModelGenerator/ModelGenerator.cs"
    click ModelModification "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/Scripts/ModelGenerator/ModelModification.cs"
    click FBXAssets "https://github.com/amanbohra7/bioarsdk/tree/main/Assets/Fbx"
    click StructuresAssets "https://github.com/amanbohra7/bioarsdk/tree/main/Assets/Structures"
    click ModelPrefab "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/Prefabs/Model_Generator .prefab"

    %% Click Events - UI & Interaction Controllers
    click ARviewUI "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/Scripts/AR_VIEW/UI/ARviewUI.cs"
    click EPanel "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/Scripts/AR_VIEW/UI/EPanel.cs"
    click ElectronDetectionUI "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/Scripts/ElectronDetections/UI/ElectrionDectectionUIManager.cs"
    click ModelGenUI "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/Scripts/ModelGenerator/UI/ModelUI.cs"

    %% Click Events - Data and Configuration
    click PeriodicTableData "https://github.com/amanbohra7/bioarsdk/tree/main/Assets/DATA/PeriodicTableJson"
    click StreamingData "https://github.com/amanbohra7/bioarsdk/blob/main/Assets/StreamingAssets/data.txt"
    click ARCoreSettings "https://github.com/amanbohra7/bioarsdk/blob/main/ProjectSettings/ARCoreProjectSettings.json"

    %% Click Events - External Libraries
    click LeanTween "https://github.com/amanbohra7/bioarsdk/tree/main/Assets/LeanTween"
    click JsonDotNet "https://github.com/amanbohra7/bioarsdk/tree/main/Assets/JsonDotNet"
    click ExternalDepManager "https://github.com/amanbohra7/bioarsdk/tree/main/Assets/ExternalDependencyManager"
    click OpenCVForUnity "https://github.com/amanbohra7/bioarsdk/tree/main/Assets/OpenCVForUnity"
```
