# HG changeset patch
# User Volker Braun <vbraun.name@gmail.com>
# Date 1364837624 3600
# Node ID e63d1bd15c2a687c6cb10f2c5849778ca80c8a91
# Parent 1d7d862fceb20059914afb8726db4fe6243b6034
Better input checking for FaceFan
diff git a/sage/geometry/fan.py b/sage/geometry/fan.py
a

b


601  601   ``polytope``  a :func:`polytope 
602  602  <sage.geometry.polyhedron.constructor.Polyhedron>` over `\QQ` or 
603  603  a :class:`lattice polytope 
604   <sage.geometry.lattice_polytope.LatticePolytopeClass>`. 
 604  <sage.geometry.lattice_polytope.LatticePolytopeClass>`. A (not 
 605  necessarily fulldimensional) polytope contaning the origin in 
 606  its :meth:`relative interior 
 607  <sage.geometry.polyhedron.base.Polyhedron_base.relative_interior_contains>`. 
605  608  
606  609   ``lattice``  :class:`ToricLattice 
607  610  <sage.geometry.toric_lattice.ToricLatticeFactory>`, `\ZZ^n`, or any 
… 
… 

665  668  sage: FaceFan(interval_in_QQ2).generating_cones() 
666  669  (1d cone of Rational polyhedral fan in 2d lattice N, 
667  670  1d cone of Rational polyhedral fan in 2d lattice N) 
 671  
 672  sage: FaceFan(Polyhedron([(1,0), (1,0), (0,1)])) # origin on facet 
 673  Traceback (most recent call last): 
 674  ... 
 675  ValueError: face fans are defined only for 
 676  polytopes containing the origin as an interior point! 
668  677  """ 
669  678  from sage.geometry.lattice_polytope import is_LatticePolytope 
670  679  interior_point_error = ValueError( 
… 
… 

676  685  cones = (facet.vertices() for facet in polytope.facets()) 
677  686  rays = polytope.vertices().columns(copy=False) 
678  687  else: 
679   if not (polytope.is_compact() and polytope.contains(polytope.ambient_space().zero())): 
 688  origin = polytope.ambient_space().zero() 
 689  if not (polytope.is_compact() and 
 690  polytope.relative_interior_contains(origin)): 
680  691  raise interior_point_error 
681  692  cones = [ [ v.index() for v in facet.incident() ] 
682  693  for facet in polytope.inequalities() ] 
… 
… 

695  706   ``polytope``  a :func:`polytope 
696  707  <sage.geometry.polyhedron.constructor.Polyhedron>` over `\QQ` 
697  708  or:class:`lattice polytope 
698   <sage.geometry.lattice_polytope.LatticePolytopeClass>`. 
 709  <sage.geometry.lattice_polytope.LatticePolytopeClass>`. A 
 710  fulldimensional polytope containing the origin as an interior 
 711  point. 
699  712  
700  713   ``lattice``  :class:`ToricLattice 
701  714  <sage.geometry.toric_lattice.ToricLatticeFactory>`, `\ZZ^n`, or any 