r/Python • u/Separate-Summer-6027 • Feb 28 '26
News trueform v0.7: extends NumPy arrays with geometric types for vectorized spatial queries
v0.7 of trueform gives NumPy arrays geometric meaning. Wrap a (3,) array and it's a Point. (2, 3) is a Segment. (N, 3) is N points. Eight primitives (Point, Line, Ray, Segment, Triangle, Polygon, Plane, AABB) and three forms (Mesh, EdgeMesh, PointCloud) backed by spatial and topological structures. Every query broadcasts over batches the way you'd expect, in parallel.
=
# signed distance from every vertex to a plane through the centroid
=
= # shape (num_verts,)
Same function, different target. Swap the plane for a mesh, the tree builds on first query:
=
= # shape (num_verts,)
Two meshes, not touching. Find the closest pair of surface points and bring them together without collision:
# False
, =
# translate mesh_b towards mesh, leave a small gap
= -
=
= *
=
# still False, tree reused, transform applied at query time
Voxelize a mesh. Build a grid of bounding boxes, check which ones the mesh occupies:
, = ,
=
=
=
= # shape (1000000,) bool
Depth map. Cast a grid of rays downward:
=
=
=
, =
= # NaN where no hit
The scalar field from the first example feeds directly into cutting. Isobands slices along threshold values, returns per-face labels and intersection curves:
, , =
, =
, =
, =
# triangulate the curves to cap the cross-section
, =
NumPy in, NumPy out. C++ backend, parallelized across cores.