#  Copyright (c) 1997-2015
#  Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
#  http://www.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.
#-------------------------------------------------------------------------------

object PolyhedralComplex {


method construct(topaz::GeometricSimplicialComplex) {
  my $complex=$_[1];
  if (!defined ($complex->lookup("FACETS"))) {
      return new PolyhedralComplex(POINTS=>(ones_vector()|$complex->COORDINATES),INPUT_POLYTOPES=>$complex->INPUT_FACES,INPUT_LINEALITY=>[]);
  }
  return new PolyhedralComplex(VERTICES=>(ones_vector()|$complex->COORDINATES->minor($complex->VERTEX_INDICES,All)),MAXIMAL_POLYTOPES=>$complex->FACETS,LINEALITY_SPACE=>[]);
}

rule FAR_VERTICES : VERTICES {
   $this->FAR_VERTICES=polytope::far_points($this->VERTICES);
}
weight 1.10;

}


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