Rational polygons database

API

The database can be queried as JSON. Invalid parameters return status 400 with a field error.

Identify accepts at most 25 vertices and denominators up to 25.

Identify

GET /polygons/api/v1/identify?vertices=(-1,-1),(2,-1),(-1,2)
{
  "in_database": true,
  "polygon": {...}
}
FieldMeaning
in_databaseWhether the polygon is in the database
polygonThe convex hull of the given points, described below

The parameter vertices is a comma-separated list of coordinates, which may be fractions like 1/2.

Search

GET /polygons/api/v1/search?k=2&i=1&page=1
{
  "total": 5129,
  "page": 1,
  "pages": 86,
  "page_size": 60,
  "complete": true,
  "incomplete_reason": null,
  "polygons": [{...}, ...]
}
FieldMeaning
totalNumber of polygons matching the search
page, pagesNumber of this page and of all pages
page_sizeMaximal number of polygons per page
completeWhether the database contains all polygons matching the search
incomplete_reasonWhich polygons may be missing, or null
polygonsThe polygons on this page, described below

The parameters are those of the search form, as in the address of a search, and page.

Polygons

{
  "url": "/polygons/polygon/1/3,0,0,3,0,0",
  "vertices": [["3", "0"], ["0", "3"], ["0", "0"]],
  "denominator": 1,
  "interior_lattice_points": 1,
  "boundary_lattice_points": 9,
  "area": "9/2",
  "number_of_vertices": 3,
  "boundary_k_rational_points": 9,
  "ehrhart_period": 1,
  "automorphism_group": "D3",
  "maximal": true,
  "integer_hull_dimension": 2,
  "interior_integer_hull_dimension": 0,
  "ldp": true,
  "thin": null
}
FieldMeaning
urlPage of the polygon
verticesVertices in affine normal form, with coordinates as strings
denominatorSmallest k such that kP has integral vertices
interior_lattice_pointsNumber of interior lattice points
boundary_lattice_pointsNumber of boundary lattice points
areaEuclidean area, as a string
number_of_verticesNumber of vertices
boundary_k_rational_pointsNumber of points of (1/k)ℤ² on the boundary, where k is the denominator
ehrhart_periodPeriod of the Ehrhart quasipolynomial
automorphism_groupGroup of affine unimodular automorphisms: Zn cyclic, Dn dihedral of order 2n
maximalWhether the polygon is maximal
integer_hull_dimensionDimension of the convex hull of the lattice points, −1 if there are none
interior_integer_hull_dimensionDimension of the convex hull of the interior lattice points, −1 if there are none
ldpWhether the polygon is LDP; null unless it has one interior lattice point
thinWhether the polygon is thin; null unless it has no interior lattice points