#  Copyright (c) 1997-2010
#  Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Darmstadt, Germany)
#  http://www.polymake.de
#
#  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.
#-------------------------------------------------------------------------------
#  $Project: polymake $$Id: point_configuration_properties.rules 9547 2010-03-09 07:21:34Z smoeser $

object PointConfiguration {

# @category Basic properties
# The Points of the configuration
property POINTS : Matrix<Scalar> {
   sub canonical { &canonicalize_points; }
}

# @category Basic properties
# The polytope being the convex hull of the point configuration.

property CONVEX_HULL : Polytope<Scalar> {

   # Indices of [[Polytope::VERTICES]] of the [[CONVEX_HULL]] as [[POINTS]].
   property VERTEX_POINT_MAP : Array<Int>;

   rule VERTEX_POINT_MAP : VertexPerm.VERTEX_POINT_MAP, VertexPerm.PERMUTATION {
     $this->VERTEX_POINT_MAP=permuted($this->VertexPerm->VERTEX_POINT_MAP, $this->VertexPerm->PERMUTATION);
   }
   weight 1.10;

}


# @category Basic properties
# Dimension of the space in which the point configuration lives.

property AMBIENT_DIM : Int;


# @category Basic properties
# True if the point configuration is a bounded polytope.

property BOUNDED : Bool;


# @category Basic properties
# Number of [[POINTS]].

property N_POINTS : Int;


# @category Basic properties
# Dimension of the affine hull of the point configuration.

property DIM : Int;

# @category Basic properties
# True if the [[POINTS]] are in convex position.

property CONVEX : Bool;

# @category Basic properties
# [[POINTS]] that are not [[Polytope::VERTICES]] of the [[CONVEX_HULL]]

property NON_VERTICES : Set;

# @category Basic properties
# Indices of [[Polytope::VERTICES]] of the [[CONVEX_HULL]] as [[POINTS]]

property VERTEX_POINT_MAP : Array<Int>;


# @category Basic properties
# Dual basis of the affine hull of the polyhedron.

property AFFINE_HULL : Matrix<Scalar>;

# @category Combinatorics
# Graph of the point configuration.
# Two points are adjacent if they lie in a common edge of the [[CONVEX_HULL]].

property GRAPH : objects::Graph;


# @category Unbounded polyhedra
# Indices of [[POINTS]] that are rays.

property FAR_POINTS : Set;

# @category Basic properties
# The center of gravity of the point configuration.

property BARYCENTER : Vector<Scalar>;


# @category Triangulation and volume
# Some triangulation of the point configuration.

property TRIANGULATION : topaz::SimplicialComplex {

   # The splits that are coarsenings of the current [[TRIANGULATION]].
   # If the triangulation is regular these form the unique split decomposition of
   # the corresponding weight function.

   property REFINED_SPLITS : Set<Int>;
   
   # GKZ-vector
   # 	See Chapter 7 in Gelfand, Kapranov, and Zelevinsky:
   # 	Discriminants, Resultants and Multidimensional Determinants, Birkhäuser 1994

   property GKZ_VECTOR : Vector<Scalar>;
  
   # DOC_FIXME: Incomprehensible description!
   # For each facet the set of simplex indices of BOUNDARY that triangulate it.
   property FACET_TRIANGULATIONS : Array<Set>;
}

# @category Triangulation and volume
# For each simplex in the [[TRIANGULATION]], this contains the sign of the determinant of its coordinate matrix, 
# which is the orientation of the simplex.
# @return Array<int>
user_method TRIANGULATION_SIGNS : TRIANGULATION.FACETS, POINTS {
   my $this=shift;
   triang_sign($this->TRIANGULATION->FACETS, $this->POINTS);
}

# @category Triangulation and volume
# Polytopal Subdivision of the point configuration.
# Each line contains indices from [[POINTS]] comprising a facet of the subdivision.

property POLYTOPAL_SUBDIVISION : Array<Set>;

# @category Triangulation and volume
# The weight vector to construct a [[TRIANGULATION]].
property WEIGHTS : Vector<Scalar>;

# @category Triangulation and volume
# Tells that [[WEIGHTS]] are generic.

property WEIGHTS_GENERIC : Bool;

# @category Triangulation and volume
# GKZ-vector of [[TRIANGULATION]].

property GKZ_VECTOR : Vector<Scalar>;

# @category Basic properties
# Unique names assigned to the [[POINTS]].
# If specified, they are shown by visualization tools instead of point indices.

property LABELS : Array<String> : mutable;

# The splits of the point configuration, i.e., hyperplanes cutting the configuration in
# two parts such that we have a regular subdivision.

property SPLITS : Matrix<Scalar>;

# Two [[SPLITS]] are compatible if the defining hyperplanes do not intersect in the
# interior of the point configuration.  This defines a graph.

property SPLIT_COMPATIBILITY_GRAPH : objects::Graph;

# The splits that are coarsenings of the current [[POLYTOPAL_SUBDIVISION]].
# If the subdivision is regular these form the unique split decomposition of
# the corresponding weight function.

property SPLITS_IN_SUBDIVISION : Set<Int>;

# @category Visualization
# [[Polytope::VIF_CYCLIC_NORMAL]] of the [[CONVEX_HULL]], but with
# the indices form [[POINTS]] instead of [[Polytope::VERTICES]]
property PIF_CYCLIC_NORMAL : Array< List<Int> >;

# @category Oriented matroids
# Chirotope corresponding to [[POINTS]]

property CHIROTOPE : Text;

}

# Local Variables:
# mode: perl
# c-basic-offset:4
# End:
