# ricosjp/truck architecture

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

- Interactive diagram: https://gitdiagram.com/ricosjp/truck
- Repository: https://github.com/ricosjp/truck

## Overview

Truck is a modular Rust CAD kernel. The principal workflow is to build geometric and topological models, apply modeling or solid operations, optionally tessellate them into polygon meshes, then render them through the graphics layer. STEP exchange, drafting, and JavaScript access are additional product capabilities. The README documents crate roles, while sampled source confirms key model, mesh, rendering, and STEP interfaces; edges for unsampled subsystems are limited to those documented roles.

Main entry points: [`truck-modeling/src/lib.rs`](https://github.com/ricosjp/truck/blob/master/truck-modeling/src/lib.rs) (Model Builder), [`truck-geometry/src/lib.rs`](https://github.com/ricosjp/truck/blob/master/truck-geometry/src/lib.rs) (Geometry Types), [`truck-polymesh/src/lib.rs`](https://github.com/ricosjp/truck/blob/master/truck-polymesh/src/lib.rs) (Polygon Mesh), [`truck-meshalgo/src/lib.rs`](https://github.com/ricosjp/truck/blob/master/truck-meshalgo/src/lib.rs) (Mesh Algorithms)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_geometry["Geometry Core"]
  node_geotrait["Geometry Traits<br/>[lib.rs]"]
  node_geometrylib["Geometry Types<br/>[lib.rs]"]
  node_topology["B-rep Topology<br/>[lib.rs]"]
  node_geometrybase["Geometry Primitives<br/>[lib.rs]"]
end

subgraph group_modeling["Modeling Operations"]
  node_modelinglib["Model Builder<br/>[lib.rs]"]
  node_shapeops["Solid Operations<br/>[lib.rs]"]
  node_drafting["Drafting<br/>[lib.rs]"]
  node_assembly["Assemblies<br/>[lib.rs]"]
end

subgraph group_mesh["Mesh Processing"]
  node_polymesh["Polygon Mesh<br/>[lib.rs]"]
  node_meshalgo["Mesh Algorithms<br/>[lib.rs]"]
end

subgraph group_visual["Visualization"]
  node_platform["Graphics Platform<br/>[lib.rs]"]
  node_rendimpl["Render Implementations<br/>[lib.rs]"]
end

subgraph group_interfaces["Exchange Interfaces"]
  node_stepio["STEP Exchange<br/>[lib.rs]"]
  node_js["JavaScript Wrapper<br/>[lib.rs]"]
end

node_user(("CAD User"))

node_user -->|"builds models"| node_modelinglib
node_modelinglib -->|"uses geometry"| node_geometrylib
node_modelinglib -->|"builds topology"| node_topology
node_geometrylib -->|"implements traits"| node_geotrait
node_geometrylib -->|"uses primitives"| node_geometrybase
node_modelinglib -.->|"can apply operations"| node_shapeops
node_modelinglib -.->|"can create drawings"| node_drafting
node_modelinglib -.->|"can assemble parts"| node_assembly
node_modelinglib -->|"can tessellate shapes"| node_meshalgo
node_meshalgo -->|"produces meshes"| node_polymesh
node_user -.->|"exchanges STEP"| node_stepio
node_stepio -.->|"exports modeled data"| node_modelinglib
node_user -.->|"uses JavaScript API"| node_js
node_polymesh -->|"provides mesh data"| node_rendimpl
node_rendimpl -->|"uses rendering API"| node_platform
node_user -->|"configures scenes"| node_platform

click node_geotrait "https://github.com/ricosjp/truck/blob/master/truck-geotrait/src/lib.rs"
click node_geometrylib "https://github.com/ricosjp/truck/blob/master/truck-geometry/src/lib.rs"
click node_topology "https://github.com/ricosjp/truck/blob/master/truck-topology/src/lib.rs"
click node_modelinglib "https://github.com/ricosjp/truck/blob/master/truck-modeling/src/lib.rs"
click node_shapeops "https://github.com/ricosjp/truck/blob/master/truck-shapeops/src/lib.rs"
click node_drafting "https://github.com/ricosjp/truck/blob/master/truck-drafting/src/lib.rs"
click node_assembly "https://github.com/ricosjp/truck/blob/master/truck-assembly/src/lib.rs"
click node_polymesh "https://github.com/ricosjp/truck/blob/master/truck-polymesh/src/lib.rs"
click node_meshalgo "https://github.com/ricosjp/truck/blob/master/truck-meshalgo/src/lib.rs"
click node_platform "https://github.com/ricosjp/truck/blob/master/truck-platform/src/lib.rs"
click node_rendimpl "https://github.com/ricosjp/truck/blob/master/truck-rendimpl/src/lib.rs"
click node_stepio "https://github.com/ricosjp/truck/blob/master/truck-stepio/src/lib.rs"
click node_js "https://github.com/ricosjp/truck/blob/master/truck-js/src/lib.rs"
click node_geometrybase "https://github.com/ricosjp/truck/blob/master/truck-base/src/lib.rs"

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_geotrait,node_geometrylib,node_topology,node_geometrybase,node_user toneBlue
class node_modelinglib,node_shapeops,node_drafting,node_assembly toneAmber
class node_polymesh,node_meshalgo toneMint
class node_platform,node_rendimpl toneRose
class node_stepio,node_js toneIndigo
```

## Components

### Geometry Core

- [Geometry Traits](https://github.com/ricosjp/truck/blob/master/truck-geotrait/src/lib.rs): `truck-geotrait/src/lib.rs`
- [Geometry Types](https://github.com/ricosjp/truck/blob/master/truck-geometry/src/lib.rs): `truck-geometry/src/lib.rs`
- [B-rep Topology](https://github.com/ricosjp/truck/blob/master/truck-topology/src/lib.rs): `truck-topology/src/lib.rs`
- [Geometry Primitives](https://github.com/ricosjp/truck/blob/master/truck-base/src/lib.rs): `truck-base/src/lib.rs`

### Modeling Operations

- [Model Builder](https://github.com/ricosjp/truck/blob/master/truck-modeling/src/lib.rs): `truck-modeling/src/lib.rs`
- [Solid Operations](https://github.com/ricosjp/truck/blob/master/truck-shapeops/src/lib.rs): `truck-shapeops/src/lib.rs`
- [Drafting](https://github.com/ricosjp/truck/blob/master/truck-drafting/src/lib.rs): `truck-drafting/src/lib.rs`
- [Assemblies](https://github.com/ricosjp/truck/blob/master/truck-assembly/src/lib.rs): `truck-assembly/src/lib.rs`

### Mesh Processing

- [Polygon Mesh](https://github.com/ricosjp/truck/blob/master/truck-polymesh/src/lib.rs): `truck-polymesh/src/lib.rs`
- [Mesh Algorithms](https://github.com/ricosjp/truck/blob/master/truck-meshalgo/src/lib.rs): `truck-meshalgo/src/lib.rs`

### Visualization

- [Graphics Platform](https://github.com/ricosjp/truck/blob/master/truck-platform/src/lib.rs): `truck-platform/src/lib.rs`
- [Render Implementations](https://github.com/ricosjp/truck/blob/master/truck-rendimpl/src/lib.rs): `truck-rendimpl/src/lib.rs`

### Exchange Interfaces

- [STEP Exchange](https://github.com/ricosjp/truck/blob/master/truck-stepio/src/lib.rs): `truck-stepio/src/lib.rs`
- [JavaScript Wrapper](https://github.com/ricosjp/truck/blob/master/truck-js/src/lib.rs): `truck-js/src/lib.rs`

### Other components

- **CAD User**

## Connections

- CAD User → Model Builder: builds models
- Model Builder → Geometry Types: uses geometry
- Model Builder → B-rep Topology: builds topology
- Geometry Types → Geometry Traits: implements traits
- Geometry Types → Geometry Primitives: uses primitives
- Model Builder → Solid Operations: can apply operations
- Model Builder → Drafting: can create drawings
- Model Builder → Assemblies: can assemble parts
- Model Builder → Mesh Algorithms: can tessellate shapes
- Mesh Algorithms → Polygon Mesh: produces meshes
- CAD User → STEP Exchange: exchanges STEP
- STEP Exchange → Model Builder: exports modeled data
- CAD User → JavaScript Wrapper: uses JavaScript API
- Polygon Mesh → Render Implementations: provides mesh data
- Render Implementations → Graphics Platform: uses rendering API
- CAD User → Graphics Platform: configures scenes
