Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
fix initialization of impty RDF polyhedron from double descpription
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Kliem committed Aug 10, 2020
1 parent 83caa4b commit c3896a2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/sage/geometry/polyhedron/backend_cdd.py
Expand Up @@ -570,6 +570,13 @@ def _init_from_Vrepresentation_and_Hrepresentation(self, Vrep, Hrep, verbose=Fal
....: Vrep_minimal=True, Hrep_minimal=True) # indirect doctest
sage: p
A 1-dimensional polyhedron in RDF^1 defined as the convex hull of 1 vertex and 1 line
Test that :trac:`30330` is fixed::
sage: P1 = polytopes.regular_polygon(5, exact=False)
sage: P2 = Polyhedron()
sage: P1*P2
The empty polyhedron in RDF^2
"""
def parse_Vrep(intro, data):
count = int(data[0][0])
Expand Down Expand Up @@ -621,6 +628,11 @@ def try_init(rep):
vertices, rays, lines = (tuple(x) for x in Vrep)
ieqs, eqns = (tuple(x) for x in Hrep)

if not (vertices or rays or lines):
# cdd refuses to handle empty polyhedra.
self._init_empty_polyhedron()
return

# We prefer the shorter representation.
# Note that for the empty polyhedron we prefer Hrepresentation.
prim = "Hrep" if len(ieqs) <= len(vertices) + len(rays) else "Vrep"
Expand Down

0 comments on commit c3896a2

Please sign in to comment.