diff --git a/doc/architecture/overall_pipeline.md b/doc/architecture/overall_pipeline.md index d0785dd..d081745 100644 --- a/doc/architecture/overall_pipeline.md +++ b/doc/architecture/overall_pipeline.md @@ -1,4 +1,21 @@ # Draft High-level Architecture + + +## Positioning and relation to existing libraries (Nice To Have but maybe to much) +ConformalLab++ is not intended to replace established geometry processing libraries such as CGAL, libigl, or Geometry Central. Instead, it acts as an experiment-friendly pipeline layer on top of existing data structures and algorithms provided by these libraries. + +The project revives the ideas and algorithms of the original ConformalLab by Stefan Sechelmann in a modern C++ setting, making them easier to combine with contemporary mesh libraries (e.g. Geometry Central for intrinsic quantities and operators) and to reuse in new experimental setups. + +In practice, ConformalLab++ focuses on: + ++ a clear, declarative pipeline description for conformal and Möbius-based mesh experiments, + ++ a unified halfedge-based UniversalMesh representation plus optional alternative representations, + +adapters and plugin units that wrap robust external implementations where appropriate (e.g. CGAL-based repair or reconstruction, Geometry Central–style discrete geometry operators, or libigl functionality) instead of reimplementing them. + + + ## High-level geometry pipeline The following diagram outlines the planned high-level pipeline for ConformalLab++. It shows the rough division into preprocessing, processing, and postprocessing. In preprocessing, various input types are first converted into a universal representation (half-edge mesh) via adapter layers and any necessary preprocessing steps. From there, they are processed by the various core processors units and then either exported or visualized in postprocessing, with minor optimizations as necessary. @@ -74,6 +91,23 @@ Each unit takes a mesh of the same type as input and produces a mesh of the same Examples: remeshing, conformal parameterization, smoothing, boolean operations, experiment-specific transforms. +Each core processing unit conceptually has the shape UniversalMesh -> UniversalMesh, but units also declare: + ++ Preconditions: requirements on the input mesh (e.g. triangulated, manifold, oriented, specific attributes present). + ++ Capabilities: guarantees on the output mesh (e.g. remains manifold, produces curvature attributes, preserves boundary). + +A simple example: + ++ RemeshingUnit + + + Preconditions: triangulated, manifold, oriented + + + Capabilities: triangulated, manifold, vertex positions modified, edge count changed + +Pipeline composition is valid if, for every adjacent pair of units, the capabilities of the previous unit satisfy the preconditions of the next unit. + + ### Postprocessing Adapts the processed mesh for external consumption: export to file formats, visualization, analysis tools. @@ -101,6 +135,8 @@ The half-edge structure encodes vertices, halfedges, faces, and their adjacency The universal mesh may carry extensible per-vertex, per-edge, and per-face attributes (e.g. UVs, curvature, experimental scalar fields). Core units can read and write these attributes while still conforming to the same mesh type, enabling complex pipelines without changing the central data structure. + + Because all processing units speak the same “mesh language”, you can build pipelines like: ```bash @@ -112,3 +148,104 @@ Preprocessing ``` without changing the basic function signature or the surrounding infrastructure, only by reordering or swapping units. + +## Declarative pipeline descriptions (Nice To Have but maybe to much) +ConformalLab++ optionally supports a lightweight YAML-based description format for experiments. +A pipeline consists of an input adapter, a sequence of steps (core processing units), and an output adapter. Each step can specify params as well as structural constraints via require and provide keys. A pipeline is considered valid if, for every step, all require conditions are satisfied by the accumulated provide and expect constraints of previous steps + +```yaml + +pipeline: + name: basic_conformal + input: + adapter: obj_reader + source: data/bunny.obj + + steps: + - id: clean + unit: repair_soft_clean + params: + mode: soft + require: + representation: UniversalMesh + triangulated: true + provide: + triangulated: true + manifold: null + + - id: param + unit: conformal_parameterization + params: + method: cauchy_riemann + require: + triangulated: true + manifold: true + provide: + attributes_add: [uv] + + output: + adapter: gltf_writer + target: out/bunny.glb + +``` +Each unit may declare a require section describing what it needs from its input (e.g. representation, triangulated, manifold, required attributes) and a provide section describing what it guarantees on its output (e.g. still triangulated, now manifold, adds a uv attribute). Pipelines are considered valid if for every step, the accumulated provide information of all previous steps satisfies the require constraints of the next step. + +### Repair Units (Nice To Have but maybe to much) + +Before entering the core conformal pipeline, input meshes are passed through an explicit preprocessing stage. This stage is responsible for turning “real-world” polygon data (often noisy, inconsistent, or non‑manifold) into a mesh that satisfies the structural requirements of the subsequent units + +ConformalLab++ provides a small set of repair units that can be combined as needed: + ++ removal of (almost) degenerate triangles (needles, caps), + ++ stitching of compatible boundary cycles to close small gaps, + ++ enforcing a consistent face orientation where possible. + +These units are conceptually similar to geometric repair routines in modern polygon mesh processing toolkits + +We distinguish between two typical modes of operation: + ++ Soft cleaning: minimally invasive repairs intended for visualization and quick experiments. Soft cleaning tries to improve mesh quality without significantly altering topology or removing components. + ++ Hard cleaning: more aggressive repairs intended for numerically robust experiments. Hard cleaning may merge vertices, remove tiny components, and modify local topology to enforce manifoldness and consistent orientation when possible. + +## More internal representations (Nice To Have but maybe to much) +ConformalLab++ distinguishes between internal representation spaces that experiments may move between: + ++ UniversalMesh: a halfedge‑based surface mesh representation used for most combinatorial and conformal algorithms. + ++ PointCloud: an unstructured set of sample points, optionally with normals and additional attributes, used for sampling, resampling, and certain reconstruction tasks. + ++ ImplicitField: a scalar field $f: \mathbf{R}^n \rightarrow \mathbf{R}$ +represented on a grid or as a procedural function, used for iso‑surface extraction and robust shape transformations. + +Each space has its own natural algorithms, and dedicated conversion units allow pipelines to move between these representations when needed. + +### Conversion units + +Typical conversion units include: + ++ mesh_to_pointcloud (sampling vertices and surfaces of a UniversalMesh into a PointCloud), + ++ pointcloud_to_mesh (surface reconstruction from point samples), + ++ mesh_to_implicit (rasterizing a UniversalMesh into a signed distance or occupancy field), + ++ implicit_to_mesh (iso‑surface extraction from an ImplicitField). + +These units are modeled as regular processing units in the pipeline but change the underlying representation space instead of just transforming a mesh + +## Attribute behaviour under topology changes (Nice To Have but maybe to much) + +ConformalLab++ treats attributes as first-class data attached to mesh entities (vertices, edges, faces, halfedges). When topology changes, attributes are updated according to simple, explicit rules: + ++ Vertex splits / edge splits: attributes on newly created vertices or edges are initialized by interpolation of the incident elements (e.g. linear interpolation of scalar fields along an edge). + ++ Edge collapse: attributes on the surviving vertex are computed from the incident vertices, typically by a convex combination or area‑weighted average for scalar quantities. + ++ Face operations (flip, subdivision): face attributes are either propagated (for categorical data) or interpolated (for scalar data) to new faces. + +By default, ConformalLab++ uses linear interpolation for scalar attributes and nearest‑neighbour propagation for discrete or categorical attributes; units may override these policies where necessary + +