$ show gradientspace/geometry3Sharp
geometry3Sharp is a comprehensive C# library for 2D/3D geometric computing and triangle mesh processing. It provides a rich set of data structures (dynamic mesh, spatial indices, graphs) and algorithms (mesh editing, remeshing, simplification, boolean operations, distance queries, implicit surfaces, hole filling, smoothing, deformation). The library also includes I/O for common mesh formats (OBJ, STL, OFF), numerical solvers (sparse CG, SVD, eigen), and utilities like parallel loops and memory-efficient containers. It is designed for integration into real-time applications and Unity via conditional compilation. While the codebase shows signs of long development with some incomplete features and deprecated APIs, it remains a powerful and well-crafted tool for geometry processing tasks.
The LLM identified 3 files worth highlighting for reuse:
A custom dynamic array using block allocation and bit-shift indexing to avoid full array copies on resize. It provides O(1) index access and amortized O(1) append, and is the foundational container used throughout the library. This pattern is self-contained and can be extracted for any project requiring a high-performance, low-memory-overhead dynamic list.
A static utility class providing simple parallel loop constructs (ForEach, BlockStartEnd) that work with .NET 3.5 and later. It abstracts away the complexity of partitioning work across threads and is used extensively in the library for mesh processing, spatial queries, and solver operations. This component is small, self-contained, and easily reusable in any C# project needing basic parallelism.
A collection of static helper methods and constants for geometric computations: zero tolerance, interpolation (lerp, smoothstep, clamp), barycentric coordinates, triangle quality metrics, winding angle, and vector direction math. Many algorithms in the library rely on these utilities. While tightly coupled to the math primitives (Vector3d, etc.), the file itself is a standalone set of functions that could be extracted with little modification if the math types are also ported.