# HG changeset patch
# User Andrey Novoseltsev <novoselt@gmail.com>
# Date 1282861565 21600
# Node ID fd3572c42f5d0744c96df4a5ea51804dac98f0c2
# Parent c9b5af6af88ac4b38198df54002373e9d54f5316
Trac 9812: Fix sorting bug in subdivision algorithm of rational polyhedral cones.
diff r c9b5af6af88a r fd3572c42f5d sage/geometry/fan.py
a

b


1242  1242  sage: for cone in new_fan: print cone.ambient_ray_indices() 
1243  1243  (0, 2) 
1244  1244  (1, 2) 
 1245  
 1246  We make sure that this function constructs cones with ordered ambient 
 1247  ray indices (see Trac 9812):: 
 1248  
 1249  sage: C = Cone([(1,0,0), (0,1,0), (1,0,1), (0,1,1)]) 
 1250  sage: F = Fan([C]).make_simplicial() 
 1251  sage: [cone.ambient_ray_indices() for cone in F] 
 1252  [(0, 1, 3), (0, 1, 2)] 
1245  1253  """ 
1246  1254  dim = self.lattice_dim() 
1247  1255  for cone in self: 
… 
… 

1300  1308  new_fan_rays = list(self.rays()) 
1301  1309  new_fan_rays.extend(ray for ray in new_rays 
1302  1310  if ray not in self.ray_set()) 
1303   cones = tuple(tuple(new_fan_rays.index(cone_polytope.vertex(v)) 
1304   for v in range(cone_polytope.nvertices()  1)) 
 1311  cones = tuple(tuple(sorted(new_fan_rays.index(cone_polytope.vertex(v)) 
 1312  for v in range(cone_polytope.nvertices()  1))) 
1305  1313  for cone_polytope in cone_polytopes) 
1306  1314  fan = Fan(cones, new_fan_rays, check=False, normalize=False) 
1307   # Since we already have all lattice polytopes, let's keep them 
1308   for cone, polytope in zip(fan.generating_cones(), cone_polytopes): 
1309   cone._lattice_polytope = polytope 
1310  1315  return fan 
1311  1316  
1312  1317  def cone_containing(self, *points): 