# jacobstoren/solvespacelib architecture

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

- Interactive diagram: https://gitdiagram.com/jacobstoren/solvespacelib
- Repository: https://github.com/jacobstoren/solvespacelib

## Overview

SolveSpaceLib is a small library exposing SolveSpace’s geometric constraint solver to applications. The main workflow is to construct parameters, entities, and constraints, request a solve, then read updated parameter values and the solve status. The graph preserves the indexed solver, sketch, geometry, and rendering modules, though the README does not describe them as separate product capabilities. Internal call relationships are only connected where shown; dashed links mark likely runtime handoffs not verified by the excerpts.

Main entry points: [`libslvs/solvespace.h`](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/solvespace.h) (Geometry declarations), [`example_S_Curve.cpp`](https://github.com/jacobstoren/solvespacelib/blob/master/example_S_Curve.cpp) (S-curve example), [`libslvs/include/SolveSpaceSystem.h`](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/include/SolveSpaceSystem.h) (C++ system wrapper), [`libslvs/lib.cpp`](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/lib.cpp) (API adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Library API"]
  node_example["S-curve example"]
  node_public_api["C solver API<br/>[slvs.h]"]
  node_system_api["C++ system wrapper<br/>[SolveSpaceSystem.h]"]
  node_system_adapter["API adapter<br/>[lib.cpp]"]
  node_system_wrapper_impl["Wrapper implementation"]
end

subgraph group_solver["Constraint Solver"]
  node_solver_engine["Solver system<br/>[system.cpp]"]
  node_constraint_equations["Constraint equations<br/>[constrainteq.cpp]"]
  node_symbolic_expressions["Symbolic expressions<br/>[expr.cpp]"]
  node_expression_types["Expression types<br/>[expr.h]"]
end

subgraph group_geometry["Geometry Model"]
  node_sketch_model["Sketch model<br/>[sketch.h]"]
  node_entities["Geometric entities<br/>[entity.cpp]"]
  node_geometry_types["Geometry declarations<br/>[solvespace.h]"]
  node_data_structures["Solver structures<br/>[dsc.h]"]
  node_surfaces["Parametric surfaces<br/>[surface.h]"]
end

subgraph group_support["Geometry Support"]
  node_polygons["Polygon geometry<br/>[polygon.h]"]
  node_rendering["Rendering interface<br/>[render.h]"]
  node_platform["Platform utilities<br/>[platform.h]"]
  node_resources["Resource declarations<br/>[resource.h]"]
end

node_application(("Calling application"))

node_application -.->|"runs example"| node_example
node_example -->|"builds and solves"| node_system_api
node_system_api -.->|"implemented by"| node_system_wrapper_impl
node_system_wrapper_impl -.->|"invokes solver API"| node_system_adapter
node_system_adapter -.->|"delegates solving"| node_solver_engine
node_constraint_equations -->|"uses declarations"| node_geometry_types
node_entities -->|"uses declarations"| node_geometry_types
node_symbolic_expressions -->|"uses declarations"| node_geometry_types
node_solver_engine -->|"uses declarations"| node_geometry_types
node_geometry_types -->|"includes"| node_platform
node_geometry_types -->|"includes"| node_resources
node_geometry_types -->|"includes"| node_data_structures
node_geometry_types -->|"includes"| node_polygons
node_geometry_types -->|"includes"| node_surfaces
node_geometry_types -->|"includes"| node_rendering
node_geometry_types -->|"includes"| node_sketch_model
node_geometry_types -->|"includes"| node_expression_types

click node_example "https://github.com/jacobstoren/solvespacelib/blob/master/example_S_Curve.cpp"
click node_public_api "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/include/slvs.h"
click node_system_api "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/include/SolveSpaceSystem.h"
click node_system_adapter "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/lib.cpp"
click node_system_wrapper_impl "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/SolveSpaceSystem.cpp"
click node_solver_engine "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/system.cpp"
click node_constraint_equations "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/constrainteq.cpp"
click node_symbolic_expressions "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/expr.cpp"
click node_expression_types "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/expr.h"
click node_sketch_model "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/sketch.h"
click node_entities "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/entity.cpp"
click node_geometry_types "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/solvespace.h"
click node_data_structures "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/dsc.h"
click node_surfaces "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/srf/surface.h"
click node_polygons "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/polygon.h"
click node_rendering "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/render/render.h"
click node_platform "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/platform/platform.h"
click node_resources "https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/resource.h"

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_example,node_public_api,node_system_api,node_system_adapter,node_system_wrapper_impl toneBlue
class node_solver_engine,node_constraint_equations,node_symbolic_expressions,node_expression_types toneAmber
class node_sketch_model,node_entities,node_geometry_types,node_data_structures,node_surfaces toneMint
class node_polygons,node_rendering,node_platform,node_resources toneRose
class node_application toneIndigo
```

## Components

### Library API

- [S-curve example](https://github.com/jacobstoren/solvespacelib/blob/master/example_S_Curve.cpp): `example_S_Curve.cpp`
- [C solver API](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/include/slvs.h): `libslvs/include/slvs.h`
- [C++ system wrapper](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/include/SolveSpaceSystem.h): `libslvs/include/SolveSpaceSystem.h`
- [API adapter](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/lib.cpp): `libslvs/lib.cpp`
- [Wrapper implementation](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/SolveSpaceSystem.cpp): `libslvs/SolveSpaceSystem.cpp`

### Constraint Solver

- [Solver system](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/system.cpp): `libslvs/system.cpp`
- [Constraint equations](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/constrainteq.cpp): `libslvs/constrainteq.cpp`
- [Symbolic expressions](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/expr.cpp): `libslvs/expr.cpp`
- [Expression types](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/expr.h): `libslvs/expr.h`

### Geometry Model

- [Sketch model](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/sketch.h): `libslvs/sketch.h`
- [Geometric entities](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/entity.cpp): `libslvs/entity.cpp`
- [Geometry declarations](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/solvespace.h): `libslvs/solvespace.h`
- [Solver structures](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/dsc.h): `libslvs/dsc.h`
- [Parametric surfaces](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/srf/surface.h): `libslvs/srf/surface.h`

### Geometry Support

- [Polygon geometry](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/polygon.h): `libslvs/polygon.h`
- [Rendering interface](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/render/render.h): `libslvs/render/render.h`
- [Platform utilities](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/platform/platform.h): `libslvs/platform/platform.h`
- [Resource declarations](https://github.com/jacobstoren/solvespacelib/blob/master/libslvs/resource.h): `libslvs/resource.h`

### Other components

- **Calling application**

## Connections

- Calling application → S-curve example: runs example
- S-curve example → C++ system wrapper: builds and solves (evidence: `example_S_Curve.cpp`)
- C++ system wrapper → Wrapper implementation: implemented by (evidence: `libslvs/SolveSpaceSystem.cpp`)
- Wrapper implementation → API adapter: invokes solver API
- API adapter → Solver system: delegates solving
- Constraint equations → Geometry declarations: uses declarations (evidence: `libslvs/constrainteq.cpp`)
- Geometric entities → Geometry declarations: uses declarations (evidence: `libslvs/entity.cpp`)
- Symbolic expressions → Geometry declarations: uses declarations (evidence: `libslvs/expr.cpp`)
- Solver system → Geometry declarations: uses declarations (evidence: `libslvs/system.cpp`)
- Geometry declarations → Platform utilities: includes (evidence: `libslvs/solvespace.h`)
- Geometry declarations → Resource declarations: includes (evidence: `libslvs/solvespace.h`)
- Geometry declarations → Solver structures: includes (evidence: `libslvs/solvespace.h`)
- Geometry declarations → Polygon geometry: includes (evidence: `libslvs/solvespace.h`)
- Geometry declarations → Parametric surfaces: includes (evidence: `libslvs/solvespace.h`)
- Geometry declarations → Rendering interface: includes (evidence: `libslvs/solvespace.h`)
- Geometry declarations → Sketch model: includes (evidence: `libslvs/solvespace.h`)
- Geometry declarations → Expression types: includes (evidence: `libslvs/solvespace.h`)
