ZeroGeometry is a high-performance 2D/3D computational geometry, spatial indexing, and point cloud processing engine for .NET with zero external dependencies. Implemented from scratch in pure C#, it provides industrial metrology, 3D laser scan registration (Iterative Closest Point via SVD), spatial nearest-neighbor lookups (KdTree/RTree), polygon boolean clipping, offsetting, and Delaunay triangulation without PCL, CGAL, or OpenCV dependencies.
-
3D Point Cloud Processing (
ZeroGeometry.Core.PointCloud):-
ICP Registration: Arun's SVD 3D rigid cloud alignment finding optimal rotation
$R$ and translation$T$ . -
Surface Normal Estimation: Local covariance eigenanalysis (Jacobi
$3\times3$ rotations) computing curvature and viewpoint-oriented normals. - Voxel Grid Downsampling: Uniform voxel filter aggregating points to centroid.
- RANSAC Plane Fitting: Robust plane estimation rejecting outliers.
-
ICP Registration: Arun's SVD 3D rigid cloud alignment finding optimal rotation
-
Spatial Indexing Structures (
ZeroGeometry.Core.Spatial):-
Balanced 3D KdTree: Median-split spatial partitioning tree for
$O(\log N)$ nearest-neighbor and radius search. - 2D R-Tree: Bounding-box hierarchical index for fast rectangle range queries.
-
Balanced 3D KdTree: Median-split spatial partitioning tree for
-
2D Polygon Boolean Ops (
ZeroGeometry.Core.Polygons):- Sutherland-Hodgman Polygon Clipping: Convex polygon clipping with exact vertex interpolation.
- Polygon Offsetting / Buffering: Minkowski dilation/erosion for tolerance boundaries.
- Delaunay Triangulation: Bowyer-Watson incremental 2D triangulation with Voronoi dual generation.
- Zero External Dependencies: Standard .NET runtime only.
Install via the .NET CLI:
dotnet add package ZeroGeometry.Coreusing ZeroGeometry.Core.Spatial;
var cloud = new List<Point3D>
{
new Point3D(0, 0, 0),
new Point3D(10, 20, 30),
new Point3D(12, 22, 31),
new Point3D(100, 200, 300)
};
// Build spatial KdTree
var tree = new KdTree3D(cloud);
// Find nearest neighbor to query point
var nearest = tree.FindNearest(new Point3D(11, 21, 30), out double distSq);
Console.WriteLine($"Nearest: ({nearest.X}, {nearest.Y}, {nearest.Z}), Distance: {Math.Sqrt(distSq):F2}");using ZeroGeometry.Core.PointCloud;
var sourceCloud = LoadPointCloud("scan_current.xyz");
var targetCloud = LoadPointCloud("cad_reference.xyz");
// Align scan to reference CAD model
var icp = new IcpRegistration(maxIterations: 30, tolerance: 1e-4);
var result = icp.Align(sourceCloud, targetCloud);
Console.WriteLine($"Fitness RMSE: {result.Rmse:F4} mm, Converged: {result.Converged}");Tested on Intel Core i7-13700K (Release x64):
| Operation | Dataset Size | Execution Time | Memory Overhead |
|---|---|---|---|
| KdTree3D Build | Contiguous node array | ||
| KdTree Nearest Query |
|
||
| ICP 3D Alignment |
|
SVD closed form | |
| 2D Delaunay Triangulation |
|
Bowyer-Watson |
MIT License © 2026 Phong Võ. Part of the ZeroPlatform project.