Domain: Software Engineering / Computational Geometry / Computer-Aided Design (CAD)
Persona: Senior Systems Architect and Computational Geometry Expert
2. Abstract
Cadova is a high-fidelity Swift library engineered for programmatic 3D modeling with a primary focus on additive manufacturing (3D printing). By leveraging the Manifold geometry kernel, the engine ensures the generation of manifold, watertight meshes through robust Boolean operations. The architecture utilizes a type-safe dimensionality system to distinguish between 2D (D2) and 3D (D3) spaces while providing a declarative API reminiscent of modern UI frameworks (SwiftUI). Key capabilities include parametric curve-following, Bézier patch deformations, and a hierarchical environment system that manages resolution (segmentation), tolerances, and 3D-printing-specific overhang strategies. The framework also incorporates a sophisticated metadata pipeline (ResultElement) and coordinate-referencing system (Anchors and Tags) to facilitate complex, modular assemblies.
3. Summary
Core Architecture (Dimensionality.swift): Employs a marker protocol system to enforce type safety between 2D and 3D operations, utilizing CrossSection for 2D and Manifold for 3D concrete implementations.
Kernel & Primitives (Package.swift, Box.swift, Sphere.swift): Integrates the Manifold geometry kernel to handle underlying C++ mesh operations. Provides standard primitives including Box, Sphere, Cylinder, Torus, and Tube, all guaranteed to be manifold.
Procedural Geometry (SDF.swift, Mesh.swift): Supports manual mesh construction via vertex/face lists and procedural surface extraction from Signed Distance Functions (SDF) using the Marching Tetrahedra algorithm.
2D-to-3D Extrusion (Circle.swift, Rectangle.swift, Polygon.swift): Features a robust suite of 2D shapes—including Arc, Ring, and Stadium—capable of being extruded or revolved into 3D space with precise control over metrics like area and perimeter.
Environment Management (EnvironmentValues.swift, Segmentation.swift): Implements a hierarchical context system for managing modeling parameters. This includes adaptive or fixed Segmentation to control tessellation quality and Tolerance for measurement variations.
Advanced Warping and Pathing (Follow3D.swift, DeformByPatch.swift): Enables complex geometric transformations where models can follow 3D parametric curves or be deformed according to Bézier patches, including automatic orientation and twist-rate limiting.
Reference System (Anchors+Public.swift, Tag.swift): Provides Anchor and Tag objects to capture and reuse world-space coordinate systems. This allows for "anchoring" geometry to specific points defined elsewhere in the model tree, simplifying part assemblies.
Additive Manufacturing Optimization (OverhangSafe.swift, CircularOverhangMethod.swift): Includes specialized algorithms to modify circular geometry for 3D printing. The teardrop and bridge methods automatically adjust shapes to eliminate steep unsupported overhangs based on the environment's naturalUpDirection.
Metadata Pipeline (ResultElement.swift, PartAssignment.swift): Utilizes a mergeable metadata system (ResultElement) to propagate non-geometric data like Part identities, semantics (solid vs. visual), and materials through the modeling pipeline.
Interoperability and Formats (Import.swift, ThreeMFLoader.swift, STLLoader.swift): Facilitates high-level file I/O, supporting STL (ASCII/Binary) and 3MF. It allows for selective part-loading from 3MF files based on names or part numbers.
Text Rendering (TextRendering.swift, GlyphRenderer.swift): Integrates FreeType and FindFont to render Unicode text as vector-based geometry, supporting multiline alignment and custom TrueType/OpenType font files.
4. Review Group Recommendation
Target Audience:
CAD/CAM Software Engineers: To evaluate the geometric kernel integration and performance of the warping/deformation algorithms.
Swift Library Developers: To review the DSL design, result builder implementation, and use of modern Swift features like TaskLocal and variadic generics.
Mechanical Engineers & Makers: To assess the utility of the programmatic API for functional 3D printing, specifically the overhang-safe primitives and modular assembly (Anchor/Tag) system.