#  Copyright (c) 1997-2018
#  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 {

file_suffix pcom

# overrides of derived [[PolyhedralFan]] properties;
# similar to overrides for [[Polytope]] objects derived from [[Cone]]

# @category Input property
property POINTS = override INPUT_RAYS;

# @category Geometry
# Number of [[POINTS]].
property N_POINTS = override N_INPUT_RAYS;

# @category Visualization
property POINT_LABELS = override INPUT_RAY_LABELS;

# @category Geometry
property VERTICES = override RAYS;

# @category Geometry
# Number of [[VERTICES]].
property N_VERTICES = override N_RAYS;

# @category Visualization
property VERTEX_LABELS = override RAY_LABELS;

# @category Geometry
property AFFINE_HULL = override LINEAR_SPAN_NORMALS;

# @category Input property
property INPUT_POLYTOPES = override INPUT_CONES;

# @category Combinatorics
property MAXIMAL_POLYTOPES = override MAXIMAL_CONES;

# @category Combinatorics
property MAXIMAL_POLYTOPES_THRU_VERTICES = override MAXIMAL_CONES_THRU_RAYS;

# @category Combinatorics
# Number of [[MAXIMAL_POLYTOPES]].
property N_MAXIMAL_POLYTOPES = override N_MAXIMAL_CONES;

# @category Combinatorics
# Array of incidence matrices of all [[MAXIMAL_POLYTOPES|maximal polytopes]].
property MAXIMAL_POLYTOPES_INCIDENCES = override MAXIMAL_CONES_INCIDENCES;

# @category Combinatorics
property MAXIMAL_POLYTOPES_COMBINATORIAL_DIMS = override MAXIMAL_CONES_COMBINATORIAL_DIMS;

# @category Geometry
property MAXIMAL_POLYTOPES_AFFINE_HULL_NORMALS = override MAXIMAL_CONES_LINEAR_SPAN_NORMALS;

# @category Geometry
property MAXIMAL_POLYTOPES_FACETS = override MAXIMAL_CONES_FACETS;

# @category Combinatorics
property POLYTOPES = override CONES;

# @category Combinatorics
property N_POLYTOPES = override N_CONES;

# @category Geometry
# True if each object in [[MAXIMAL_POLYTOPES]] is [[Polytope::BOUNDED|bounded]].
property BOUNDED : Bool;

# @category Geometry
# Indices of vertices that are rays.

property FAR_VERTICES : Set;


# @category Geometry
# Returns the //i//-th facet of the complex as a [[Polytope]].
# @param Int i 
# @return Polytope
# warning: might be unbounded
user_method polytope($) : MAXIMAL_POLYTOPES {
   my $p=new Polytope<Scalar>($_[0]->cone($_[1]));
   return $p;
}

# @category Geometry
# Returns the dimension of the ambient space.
# @return Int
user_method AMBIENT_DIM {
  my ($self)=@_;
  return $self->FAN_AMBIENT_DIM-1;
}

# @category Geometry
# Returns the dimension of the linear space spanned by the complex.
# @return Int
user_method DIM {
  my ($self)=@_;
  if (!defined ($self->lookup("LINEALITY_SPACE | INPUT_LINEALITY | INPUT_RAYS | RAYS | FACET_NORMALS | LINEAR_SPAN_NORMALS"))) {
    return $self->COMBINATORIAL_DIM;
  }
  return $self->FAN_DIM-1;
}

}

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