API Reference

Submodules

The coxeter package simplifies working with shapes in 2D and 3D.

While many computational geometry tools exist, they almost exclusively aim to solve problems on the more complex end that are the subject of much study, such as the construction of convex hulls, Delaunay triangulations, and Voronoi tessellations. The coxeter package is instead aimed at providing transparent APIs for the generation of shapes and the calculation of quantities for which formulas are well-known but nontrivial to implement in robust ways. For instance, given a set of vertices defining a convex polyhedron, coxeter can automatically compute the faces of the polyhedron and keep face indices sorted appropriately for use in most computational geometry applications. The package is especially designed for calculations of interest in physics-based applications such as inertia tensors.

Functions:

from_gsd_type_shapes(params[, dimensions])

Create a Shape from a dict conforming to the GSD schema.

coxeter.from_gsd_type_shapes(params, dimensions=3)

Create a Shape from a dict conforming to the GSD schema.

See here for the specification of the schema. Note that the schema does not differentiate between 2D and 3D shapes for spheres (vs. circles) and ellipsoids (vs. ellipses) because in context the dimensionality of those shapes can be inferred from simulation boxes. To address this ambiguity, this function accepts a dimensions parameter that can be used to disambiguate explicitly between these two cases.

Parameters
  • params (dict) – The parameters of the shape to construct.

  • dimensions (int) – The dimensionality of the shape (either 2 or 3). Ignored except when the shape is a sphere or an ellipsoid, in which case a value of 2 is used to indicate generating a Circle or Ellipse instead of a Sphere or Ellipsoid (Default value: 3).

Returns

The desired shape.

Return type

Shape