RationalPolygons.jl

RationalPolygons.jl is a pure Julia package for computations with rational convex polygons. It implements

I have written RationalPolygons.jl in the span of about six months while working on a joint project with Martin Bohnert [1]. Its main purpose is to provide reference implementations of the classification algorithms developed in our paper. However, it also implements many more basic algorithms for computations with rational polygons that I believe might be useful in other projects, hence I have documented them here. RationalPolygons.jl does not make use of any external computer algebra system but implements all necessary algorithms, including two-dimensional euclidian geometry, from scratch in pure Julia. This allows for quite good performance, with computations involving billions of polygons being feasable on a personal computer.

Quick start

julia> using RationalPolygons
julia> P = convex_hull(LatticePoint{Int}[(1,0),(0,1),(-1,1),(-1,0),(0,-1),(1,-1)])Rational polygon of rationality 1 with 6 vertices.
julia> plot_polygon(P)ERROR: UndefVarError: plot_polygon not defined

image

julia> number_of_interior_lattice_points(P)1
julia> number_of_boundary_lattice_points(P)6
julia> euclidian_area(P)3//1
julia> ehrhart_quasipolynomial(P)1×3 Matrix{Int64}: 6 6 2
julia> affine_automorphism_group(P)D6
julia> is_ldp(P)true
julia> dual(P)Rational polygon of rationality 1 with 6 vertices.
julia> are_affine_equivalent(P, dual(P))true
julia> gorenstein_index(P)1