Working with 3D data requires a different set of primitives than standard ML. Most libraries abstract these away. I wanted to understand them from the ground up.
barebones-ml is an ongoing personal library — C++ implementations with PyTorch bindings, focused on the data structures and algorithms that matter for 3D spatial reasoning.
What's in it
Octree — C++ implementation with PyTorch bindings. Used for spatial partitioning in point cloud tasks like nearest neighbour search, range queries, subdivision. Exposed to Python as from barebones import octree.
Lowest Common Ancestor — LCA queries on hierarchical 3D model structures. Given a tree of parts with metadata, find the deepest common ancestor between any two nodes.
Chamfer Distance — A simple way to measure similarity between two point clouds, usually to calculate loss metric.
Farthest Point Sampling — Downsampling points while keeping good spatial coverage.
PointNet (basics) — Early pieces for learning directly on point sets.
(ongoing)
Why C++ with Python bindings
3D spatial operations are compute-heavy. Python is fine for orchestration but not for tight loops over millions of points. C++ with PyTorch bindings keeps the performance and stays in the PyTorch ecosystem — gradients, tensors, CUDA all work as expected.
Status
Active. More structures and algorithms being added as needed.