#  Copyright (c) 1997-2021
#  Ewgenij Gawrilow, Michael Joswig, and the polymake team
#  Technische Universität Berlin, Germany
#  https://polymake.org
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by the
#  Free Software Foundation; either version 2, or (at your option) any
#  later version: http://www.gnu.org/licenses/gpl.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#-------------------------------------------------------------------------------


# @topic application
# This is the historically first application, and the largest one.
#
# It deals with convex pointed polyhedra.  It allows to define a polyhedron either as a convex hull of a point set, an intersection of
# halfspaces, or as an incidence matrix without any embedding.  Then you can ask for a plenty of its (especially combinatorial)
# properties,  construct new polyhedra by modifying it,  or study the behavior of the objective functions.
#
# There is a wide range of visualization methods for polyhedra, even for dimensions > 4 and purely combinatorial descriptions,
# including interfaces to interactive geometry viewers (such as [[wiki:external_software#JavaView|JavaView]] or [[wiki:external_software#geomview|geomview]]), generating
# PostScript drawings and povray scene files.

IMPORT graph

USE topaz group ideal

HELP help.rules


# A polyhedral cone, not necessarily pointed.
# Note that in contrast to the vertices of a polytope, the [[RAYS]] are given in affine coordinates.
# @tparam Scalar numeric data type used for the coordinates, must be an ordered field. Default is [[Rational]].
declare object Cone<Scalar=Rational> [ is_ordered_field(Scalar) ];

# Not necessarily bounded convex polyhedron, i.e., the feasible region of a linear program.
# Nonetheless, the name "Polytope" is used for two reasons: Firstly, as far as the combinatorics
# is concerned we always deal with polytopes; see the description of [[VERTICES_IN_FACETS]] for details.
# Note that a pointed polyhedron is projectively equivalent to a polytope.
# The second reason is historical.
# We use homogeneous coordinates, which is why Polytope is derived from [[Cone]].
# @example To construct a polytope as the convex hull of three points in the plane use
# > $p=new Polytope(POINTS=>[[1,0,0],[1,1,0],[1,0,1]]);
# > print $p->N_FACETS
# | 3
# Note that homogeneous coordinates are used throughout.
#
# @example Many standard constructions are available directly.  For instance, to get a regular 120-cell (which is 4-dimensional) use:
# > $c=regular_120_cell();
# > print $c->VOLUME;
# | 1575+705r5
# This is the exact volume 1575+705*\sqrt{5}.
# polymake has limited support for polytopes with non-rational coordinates.
declare object Polytope<Scalar=Rational> [ is_ordered_field(Scalar) ] : Cone<Scalar>;


# these rules are intrinsic: they don't depend on any external software to be installed separately
INCLUDE
  cone_properties.rules
  polytope_properties.rules
  lp_properties.rules
  initial.rules
  cone_common.rules
  incidence_perm.rules
  common.rules
  lp.rules
  to.rules
  unbounded_polyhedron.rules
  rational.rules
  float.rules
  solids.rules
  flag_vector.rules
  lattice.rules
  milp_properties.rules
  to_milp.rules
  vector_configuration.rules
  point_configuration.rules
  polarize.rules
  visual.rules
  stl.rules
  schlegel.rules
  visual_graph.rules
  gale.rules
  steiner.rules
  voronoi.rules
  tight_span.rules
  propagated_polytope.rules
  edge_orientable.rules
  visual_point_configuration.rules
  action.rules
  group.rules
  coxeter.rules
  quotient_space.rules
  symmetrized_cocircuit_equations.rules
  universal_polytope.rules
  arbitrary_coords.rules
  representations.rules
  orbit_polytope.rules
  orbit_polytope_helpers.rules
  orbit_polytope_visual.rules
  wronski.rules
  slack_ideal.rules

# self-configuring rules
INCLUDE
  postscript.rules
  common::geomview.rules
  mptopcom.rules
  topcom.rules
  azove.rules

# @category Convex hull computation
# Use the //double description// method as implemented in [[wiki:external_software#cddlib]].
# It is the default algorithm for computation of facets from points or dually.
# It operates with arbitrary precision arithmetic ([[wiki:external_software#GMP]]).
label cdd

# @category Convex hull computation
# Use the //reverse search// method, as implemented in [[wiki:external_software#lrslib]].
label lrs

# @category Convex hull computation
# Use the convex hull code implemented in [[wiki:external_software#ppl]].
label ppl

prefer *.convex_hull ppl, cdd, lrs, beneath_beyond

prefer *.simplex cdd, lrs, to

# Local Variables:
# mode: perl
# cperl-indent-level: 3
# indent-tabs-mode:nil
# End:
