System Architecture
The three-layer structure behind Balarhinos.
Balarhinos is built on a robust three-layer architecture designed for performance, portability, and maintainability.
The Three Layers
Balarhinos separates concerns into three distinct layers:
Layer 3: UI (Next.js / React / TypeScript)
The user interface is a modern web application running inside Rhino via WebView2. It handles semantic tagging dashboards, analysis controls, and real-time monitoring.
Layer 2: Intelligence Kernel (C# / RhinoCommon)
The core logic of the plugin lives in C#. This layer manages the dependency graph, urban metrics services, and orchestrates the various systems like plot division.
Layer 1: Native Engine (C++ / OptiX / CUDA)
For computationally heavy tasks like ray tracing, Balarhinos uses a high-performance native engine. This C++ layer communicates directly with the GPU to provide real-time occlusion and context testing.
Data Flow
Communication between these layers is optimized for speed:
- UI ↔ Plugin: A high-speed asynchronous bridge (<100ms) handles typed messages between the Next.js UI and the C# kernel.
- Plugin ↔ Native: P/Invoke is used to pass geometry and analysis parameters to the OptiX ray tracing engine.
graph TD
UI[Layer 3: UI Next.js/React] -->|WebView2 Bridge| Plugin[Layer 2: C# Intelligence Kernel]
Plugin -->|P/Invoke| Native[Layer 1: OptiX/CUDA Native]
Technology Stack
| Layer | Technology | Version |
|---|---|---|
| UI | Next.js, React, TypeScript | 16.x, 19.x, 5.x |
| Plugin | C# .NET, RhinoCommon | 8.0, Rhino 8 |
| Native | OptiX, CUDA | 8.1.0, 12.9 |
| Bridge | WebView2 | Latest |
Performance Targets
We prioritize responsiveness above all else:
- Bridge Communication: <100ms
- Incremental System Update: <100ms
- Urban Metrics Calculation: <50ms
- OptiX Sun Study (Live): Real-time (FPS dependent on GPU)