prophys.structures

prophys.structures#

Differentiable spatial structures: points, lines, routes, rays, shapes, rasters, meshes and networks.

Each structure lives in a Frame and exposes geometric primitives (distances, containment, interpolation, lengths and areas) that return symbolic expressions, differentiable in both the structure’s coordinates and the query points. Hard and smooth variants follow the model’s compile(mode=, tau=) setting unless a call pins them.

Classes

Point

A single point, a PointList of length 1 with the same API.

PointList

An immutable collection of n points in frame, shape (n, ndim).

Line

A single straight segment, a LineList of length 1 with the same API.

LineList

A set of m independent straight 2D segments in frame, such as roads or power lines.

Polyline

An ordered, connected route of v vertices in frame, with positions by arc length.

Ray

A single half infinite ray, a RayList of length 1 with the same API.

RayList

A set of m half infinite rays origin + t * direction, t >= 0 in frame.

Polygon

A single closed polygon (no holes) in frame.

PolygonList

A collection of k polygons in frame that share the same vertex count v.

Polyhedron

A single convex 3D polyhedron given by halfspaces A x <= b.

PolyhedronList

A collection of k convex polyhedra that share the same face count m.

Ellipse

A single rotatable ellipse in frame, with exact signed distance.

EllipseList

A collection of k rotatable ellipses in frame.

Field

A scalar or vector raster on a regular 2D grid in frame, with bilinear interpolation.

Grid

A regular 2D grid of candidate or evaluation points in frame.

Field3D

A scalar or vector voxel raster on a regular 3D grid in frame, with trilinear interpolation.

Grid3

A regular 3D lattice of evaluation positions in frame.

Mesh

A fixed 2D triangulation in frame carrying a scalar field at its vertices, with P1 interpolation.

Network

A directed graph embedded in frame, with optional transmission weights on its edges.