-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture Overview
Two native codebases share one design: a dependency-ordered core of pure geometry/IO logic with zero UI knowledge, wrapped by a platform-native UI. This keeps the unfold algorithm identical across platforms and independently testable.
For build commands and the project table, see the README; this page explains the shape of the code.
Five projects in a strict one-way dependency chain. Domain has zero external dependencies.
flowchart LR
Domain --> Geometry --> Application --> Infrastructure --> App
| Layer | Project | Responsibility | Key types |
|---|---|---|---|
| Domain | FourHUnfolder.Domain |
Pure data model, no deps |
Mesh, Face, Edge, UnfoldResult, AppSettings, FlapMode, FlapOverride
|
| Geometry | FourHUnfolder.Geometry |
The unfold pipeline |
UnfoldEngine, KruskalMstBuilder, DualGraphBuilder, GlueTabGenerator
|
| Application | FourHUnfolder.Application |
Use-case services |
MeshService, UnfoldService, ProjectSerializer, SettingsService
|
| Infrastructure | FourHUnfolder.Infrastructure |
File IO / export |
ObjMeshLoader, PdoMeshLoader, AssimpMeshLoader, SvgExporter, PdfExporter
|
| App (WPF) | FourHUnfolder.App |
MVVM UI |
MainViewModel, PatternCanvasControl, AssemblyViewModel, EditFlapsViewModel
|
No circular dependencies. UI (App) never reaches past Application into Geometry directly.
Two Swift Package targets. The heavy lifting lives in a UI-free library that mirrors the Windows Domain+Geometry+Application+Infrastructure layers; the app target is thin SwiftUI.
flowchart LR
Core["FourHUnfolderCore<br/>(pure Swift, no UI)"] --> App["FourHUnfolder<br/>(SwiftUI app)"]
| Target | Folder | Contents |
|---|---|---|
FourHUnfolderCore |
Core/ |
Algorithms, Graph, Math, Models
|
IO/ |
Loaders (OBJ, PDO), Exporters (SVG, PDF) |
|
Services/ |
UnfoldService, ProjectSerializer
|
|
FourHUnfolder (app) |
Models/, State/
|
AppState (ObservableObject), view models |
Views/ |
MainView, SceneKitView, PatternCanvasView, SidebarView
|
Keeping algorithms in FourHUnfolderCore means they're covered by XCTest without spinning up
any UI — the same discipline as the Windows Geometry project.
- Testability — the unfold pipeline and IO are pure functions of their inputs; both platforms unit-test them directly (Windows xUnit, macOS XCTest).
- Parity — the unfold algorithm is implemented once per language against the same design, so results match.
-
Portability of data — because state and serialization live in the core, the
.4hubundle is cross-platform.
The only deliberately platform-specific area is rendering, mapped to each OS's native stack:
| Concern | Windows | macOS |
|---|---|---|
| 3D viewport | WPF 3D / DirectX | SceneKit (Metal) |
| 2D canvas | WPF Canvas (PatternCanvasControl) |
SwiftUI Canvas (PatternCanvasView) |
| PDF export | PdfExporter |
Core Graphics |
| Extra mesh formats | Assimp (assimp.dll) |
— |
4H-Unfolder — Windows v0.2.0.A · macOS v0.0.0.5-alpha · MIT License
👤 Using 4H-Unfolder
- Installation
- Quick Start
- Editing Edges & Flaps
- Export & Printing
- Project Files (.4hu)
- FAQ & Troubleshooting
🛠 Development
📖 Reference
🔗 Links