# mozgan/rch architecture

> Architecture diagram of the GitHub repository mozgan/rch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mozgan/rch
- Repository: https://github.com/mozgan/rch

## Overview

RCH is a header-only C++ library for producing deterministic point-cloud orderings, accompanied by command-line tools and research workflows. Its main path reads indexed 3D points, estimates a robust frame, assigns per-axis bit depths, quantizes coordinates, and sorts curve keys into a permutation. A separate documented application workflow prepares paged layouts and runs spatial-window queries. The graph also captures synthetic benchmark generation and measurement. Some algorithm modules and application internals were not excerpted; their links are omitted where the available evidence does not establish calls.

Main entry points: [`include/rch/orderings/orderer.hpp`](https://github.com/mozgan/rch/blob/main/include/rch/orderings/orderer.hpp) (Ordering API), [`include/rch/robust/det_mcd.hpp`](https://github.com/mozgan/rch/blob/main/include/rch/robust/det_mcd.hpp) (DetMCD estimator), [`src/cli/rch_application_workflow.cpp`](https://github.com/mozgan/rch/blob/main/src/cli/rch_application_workflow.cpp) (Application workflow CLI), [`experiments/runners/run_application_query_smoke.py`](https://github.com/mozgan/rch/blob/main/experiments/runners/run_application_query_smoke.py) (Query smoke runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ordering["Ordering library"]
  node_xyz["XYZ parser<br/>[xyz_parse.hpp]"]
  node_orderer["Ordering API<br/>[orderer.hpp]"]
  node_matrix["3D primitives<br/>[matrix3.hpp]"]
  node_sha["Output digest<br/>[sha256.hpp]"]
  node_cli["Order CLI<br/>[rch_order.cpp]"]
end

subgraph group_robust["Robust geometry"]
  node_frame["Principal frame"]
  node_eigen["Eigen solver<br/>[eigen3x3.hpp]"]
  node_detmcd["DetMCD estimator<br/>[det_mcd.hpp]"]
  node_initial["Initial estimators"]
  node_correction["MCD correction<br/>[mcd_correction.hpp]"]
  node_median["Median MAD<br/>[median_mad.hpp]"]
  node_mrcd["Regularized MCD<br/>[mrcd.hpp]"]
  node_ogk["OGK estimator<br/>[ogk.hpp]"]
end

subgraph group_curves["Curve encoding"]
  node_bits["Bit allocation"]
  node_budget["Bit budget<br/>[bit_budget.hpp]"]
  node_quantization["Quantization<br/>[quantization.hpp]"]
  node_hilbert["Compact Hilbert"]
end

subgraph group_application["Paged queries"]
  node_application["Application workflow CLI"]
  node_pagefile[("Page file<br/>[page_file.hpp]")]
  node_directory["Page directory<br/>[page_directory.hpp]"]
  node_query["Window query<br/>[window_query.hpp]"]
  node_layouts["Layout policies"]
end

subgraph group_research["Research workflows"]
  node_generator["Synthetic generators<br/>[common.py]"]
  node_matrixrun["Benchmark matrix<br/>[run_matrix.py]"]
  node_smoke["Query smoke runner"]
  node_analysis["Query analysis"]
  node_converter["Dataset converter<br/>[convert_dataset.py]"]
end

node_user(("Library user"))

node_user -->|"orders points"| node_orderer
node_cli -->|"parses coordinates"| node_xyz
node_cli -->|"requests ordering"| node_orderer
node_orderer -.->|"estimates frame"| node_frame
node_orderer -.->|"allocates bits"| node_bits
node_orderer -.->|"quantizes points"| node_quantization
node_orderer -.->|"sorts curve keys"| node_hilbert
node_orderer -->|"hashes result"| node_sha
node_frame -.->|"uses estimator"| node_detmcd
node_detmcd -->|"initializes subsets"| node_initial
node_detmcd -->|"corrects estimate"| node_correction
node_detmcd -->|"uses robust scales"| node_median
node_detmcd -->|"solves eigenproblem"| node_eigen
node_mrcd -->|"reuses estimator"| node_detmcd
node_bits -->|"checks budget"| node_budget
node_hilbert -->|"uses bit budget"| node_budget
node_application -->|"parses coordinates"| node_xyz
node_application -->|"computes ordering"| node_orderer
node_application -->|"prepares pages"| node_directory
node_application -->|"runs queries"| node_query
node_directory -->|"uses page storage"| node_pagefile
node_query -->|"reads candidate pages"| node_pagefile
node_smoke -->|"uses converted data"| node_converter
node_smoke -->|"validates layouts"| node_layouts
node_generator -->|"supplies point clouds"| node_matrixrun
node_smoke -.->|"produces query artifacts"| node_analysis

click node_xyz "https://github.com/mozgan/rch/blob/main/include/rch/io/xyz_parse.hpp"
click node_orderer "https://github.com/mozgan/rch/blob/main/include/rch/orderings/orderer.hpp"
click node_matrix "https://github.com/mozgan/rch/blob/main/include/rch/core/matrix3.hpp"
click node_frame "https://github.com/mozgan/rch/blob/main/include/rch/frames/robust_principal_frame.hpp"
click node_eigen "https://github.com/mozgan/rch/blob/main/include/rch/frames/eigen3x3.hpp"
click node_detmcd "https://github.com/mozgan/rch/blob/main/include/rch/robust/det_mcd.hpp"
click node_initial "https://github.com/mozgan/rch/blob/main/include/rch/robust/initial_estimators.hpp"
click node_correction "https://github.com/mozgan/rch/blob/main/include/rch/robust/mcd_correction.hpp"
click node_median "https://github.com/mozgan/rch/blob/main/include/rch/robust/median_mad.hpp"
click node_mrcd "https://github.com/mozgan/rch/blob/main/include/rch/robust/mrcd.hpp"
click node_ogk "https://github.com/mozgan/rch/blob/main/include/rch/robust/ogk.hpp"
click node_bits "https://github.com/mozgan/rch/blob/main/include/rch/curves/bit_allocation_occupancy.hpp"
click node_budget "https://github.com/mozgan/rch/blob/main/include/rch/curves/bit_budget.hpp"
click node_quantization "https://github.com/mozgan/rch/blob/main/include/rch/curves/quantization.hpp"
click node_hilbert "https://github.com/mozgan/rch/blob/main/include/rch/curves/hilbert3_compact.hpp"
click node_sha "https://github.com/mozgan/rch/blob/main/include/rch/core/sha256.hpp"
click node_cli "https://github.com/mozgan/rch/blob/main/src/cli/rch_order.cpp"
click node_application "https://github.com/mozgan/rch/blob/main/src/cli/rch_application_workflow.cpp"
click node_pagefile "https://github.com/mozgan/rch/blob/main/include/rch/application/page_file.hpp"
click node_directory "https://github.com/mozgan/rch/blob/main/include/rch/application/page_directory.hpp"
click node_query "https://github.com/mozgan/rch/blob/main/include/rch/application/window_query.hpp"
click node_layouts "https://github.com/mozgan/rch/blob/main/experiments/application_layouts.py"
click node_generator "https://github.com/mozgan/rch/blob/main/data/synthetic/generators/common.py"
click node_matrixrun "https://github.com/mozgan/rch/blob/main/experiments/runners/run_matrix.py"
click node_smoke "https://github.com/mozgan/rch/blob/main/experiments/runners/run_application_query_smoke.py"
click node_analysis "https://github.com/mozgan/rch/blob/main/analysis/scripts/analyze_application_query_metrics.py"
click node_converter "https://github.com/mozgan/rch/blob/main/scripts/convert_dataset.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_xyz,node_orderer,node_matrix,node_sha,node_cli,node_user toneBlue
class node_frame,node_eigen,node_detmcd,node_initial,node_correction,node_median,node_mrcd,node_ogk toneAmber
class node_bits,node_budget,node_quantization,node_hilbert toneMint
class node_application,node_pagefile,node_directory,node_query,node_layouts toneRose
class node_generator,node_matrixrun,node_smoke,node_analysis,node_converter toneIndigo
```

## Components

### Ordering library

- [XYZ parser](https://github.com/mozgan/rch/blob/main/include/rch/io/xyz_parse.hpp): `include/rch/io/xyz_parse.hpp`
- [Ordering API](https://github.com/mozgan/rch/blob/main/include/rch/orderings/orderer.hpp): `include/rch/orderings/orderer.hpp`
- [3D primitives](https://github.com/mozgan/rch/blob/main/include/rch/core/matrix3.hpp): `include/rch/core/matrix3.hpp`
- [Output digest](https://github.com/mozgan/rch/blob/main/include/rch/core/sha256.hpp): `include/rch/core/sha256.hpp`
- [Order CLI](https://github.com/mozgan/rch/blob/main/src/cli/rch_order.cpp): `src/cli/rch_order.cpp`

### Robust geometry

- [Principal frame](https://github.com/mozgan/rch/blob/main/include/rch/frames/robust_principal_frame.hpp): `include/rch/frames/robust_principal_frame.hpp`
- [Eigen solver](https://github.com/mozgan/rch/blob/main/include/rch/frames/eigen3x3.hpp): `include/rch/frames/eigen3x3.hpp`
- [DetMCD estimator](https://github.com/mozgan/rch/blob/main/include/rch/robust/det_mcd.hpp): `include/rch/robust/det_mcd.hpp`
- [Initial estimators](https://github.com/mozgan/rch/blob/main/include/rch/robust/initial_estimators.hpp): `include/rch/robust/initial_estimators.hpp`
- [MCD correction](https://github.com/mozgan/rch/blob/main/include/rch/robust/mcd_correction.hpp): `include/rch/robust/mcd_correction.hpp`
- [Median MAD](https://github.com/mozgan/rch/blob/main/include/rch/robust/median_mad.hpp): `include/rch/robust/median_mad.hpp`
- [Regularized MCD](https://github.com/mozgan/rch/blob/main/include/rch/robust/mrcd.hpp): `include/rch/robust/mrcd.hpp`
- [OGK estimator](https://github.com/mozgan/rch/blob/main/include/rch/robust/ogk.hpp): `include/rch/robust/ogk.hpp`

### Curve encoding

- [Bit allocation](https://github.com/mozgan/rch/blob/main/include/rch/curves/bit_allocation_occupancy.hpp): `include/rch/curves/bit_allocation_occupancy.hpp`
- [Bit budget](https://github.com/mozgan/rch/blob/main/include/rch/curves/bit_budget.hpp): `include/rch/curves/bit_budget.hpp`
- [Quantization](https://github.com/mozgan/rch/blob/main/include/rch/curves/quantization.hpp): `include/rch/curves/quantization.hpp`
- [Compact Hilbert](https://github.com/mozgan/rch/blob/main/include/rch/curves/hilbert3_compact.hpp): `include/rch/curves/hilbert3_compact.hpp`

### Paged queries

- [Application workflow CLI](https://github.com/mozgan/rch/blob/main/src/cli/rch_application_workflow.cpp): `src/cli/rch_application_workflow.cpp`
- [Page file](https://github.com/mozgan/rch/blob/main/include/rch/application/page_file.hpp): `include/rch/application/page_file.hpp`
- [Page directory](https://github.com/mozgan/rch/blob/main/include/rch/application/page_directory.hpp): `include/rch/application/page_directory.hpp`
- [Window query](https://github.com/mozgan/rch/blob/main/include/rch/application/window_query.hpp): `include/rch/application/window_query.hpp`
- [Layout policies](https://github.com/mozgan/rch/blob/main/experiments/application_layouts.py): `experiments/application_layouts.py`

### Research workflows

- [Synthetic generators](https://github.com/mozgan/rch/blob/main/data/synthetic/generators/common.py): `data/synthetic/generators/common.py`
- [Benchmark matrix](https://github.com/mozgan/rch/blob/main/experiments/runners/run_matrix.py): `experiments/runners/run_matrix.py`
- [Query smoke runner](https://github.com/mozgan/rch/blob/main/experiments/runners/run_application_query_smoke.py): `experiments/runners/run_application_query_smoke.py`
- [Query analysis](https://github.com/mozgan/rch/blob/main/analysis/scripts/analyze_application_query_metrics.py): `analysis/scripts/analyze_application_query_metrics.py`
- [Dataset converter](https://github.com/mozgan/rch/blob/main/scripts/convert_dataset.py): `scripts/convert_dataset.py`

### Other components

- **Library user**

## Connections

- Library user → Ordering API: orders points (evidence: `README.md`)
- Order CLI → XYZ parser: parses coordinates (evidence: `src/cli/rch_order.cpp`)
- Order CLI → Ordering API: requests ordering (evidence: `src/cli/rch_order.cpp`)
- Ordering API → Principal frame: estimates frame (evidence: `include/rch/orderings/orderer.hpp`)
- Ordering API → Bit allocation: allocates bits (evidence: `include/rch/orderings/orderer.hpp`)
- Ordering API → Quantization: quantizes points (evidence: `include/rch/orderings/orderer.hpp`)
- Ordering API → Compact Hilbert: sorts curve keys (evidence: `include/rch/orderings/orderer.hpp`)
- Ordering API → Output digest: hashes result (evidence: `include/rch/orderings/orderer.hpp`)
- Principal frame → DetMCD estimator: uses estimator
- DetMCD estimator → Initial estimators: initializes subsets (evidence: `include/rch/robust/det_mcd.hpp`)
- DetMCD estimator → MCD correction: corrects estimate (evidence: `include/rch/robust/det_mcd.hpp`)
- DetMCD estimator → Median MAD: uses robust scales (evidence: `include/rch/robust/det_mcd.hpp`)
- DetMCD estimator → Eigen solver: solves eigenproblem (evidence: `include/rch/robust/det_mcd.hpp`)
- Regularized MCD → DetMCD estimator: reuses estimator (evidence: `include/rch/robust/mrcd.hpp`)
- Bit allocation → Bit budget: checks budget (evidence: `include/rch/curves/bit_allocation_occupancy.hpp`)
- Compact Hilbert → Bit budget: uses bit budget (evidence: `include/rch/curves/hilbert3_compact.hpp`)
- Application workflow CLI → XYZ parser: parses coordinates (evidence: `src/cli/rch_application_workflow.cpp`)
- Application workflow CLI → Ordering API: computes ordering (evidence: `src/cli/rch_application_workflow.cpp`)
- Application workflow CLI → Page directory: prepares pages (evidence: `src/cli/rch_application_workflow.cpp`)
- Application workflow CLI → Window query: runs queries (evidence: `src/cli/rch_application_workflow.cpp`)
- Page directory → Page file: uses page storage (evidence: `include/rch/application/page_directory.hpp`)
- Window query → Page file: reads candidate pages (evidence: `include/rch/application/window_query.hpp`)
- Query smoke runner → Dataset converter: uses converted data (evidence: `experiments/runners/run_application_query_smoke.py`)
- Query smoke runner → Layout policies: validates layouts (evidence: `experiments/runners/run_application_query_smoke.py`)
- Synthetic generators → Benchmark matrix: supplies point clouds (evidence: `experiments/runners/run_matrix.py`)
- Query smoke runner → Query analysis: produces query artifacts
