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

Commit

Permalink
Trac #27366 use new .parametric_form
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrenn committed Mar 7, 2019
1 parent f8cb228 commit 8fa37df
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/sage/geometry/polyhedron/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6961,19 +6961,12 @@ def affine_hull(self, as_polyhedron=None, as_affine_map=False,
# see TODO
if not self.is_compact():
raise NotImplementedError('"orthogonal=True" and "orthonormal=True" work only for compact polyhedra')
# translate 0th vertex to the origin
v0 = vector(self.vertices()[0])
Q = self.translation(-v0)
q0 = next((_ for _ in Q.vertices() if _.vector() == Q.ambient_space().zero()), None)
# finding the zero in Q; checking that Q actually has a vertex zero
assert q0.vector() == Q.ambient_space().zero()
q0_neighbors = list(itertools.islice(q0.neighbors(), self.dim()))
# choose as an affine basis the neighbors of the origin vertex in Q
M = matrix(self.base_ring(), self.dim(), self.ambient_dim(),
[list(w) for w in q0_neighbors])
parametric_form = self.parametric_form()
if return_all_data:
result['polyhedron_base'] = v0
result['polyhedron_base_vertices'] = q0_neighbors
result['parametric_form'] = parametric_form
v0, vi = parametric_form
# choose as an affine basis the neighbors of the origin vertex
M = matrix(self.base_ring(), self.dim(), self.ambient_dim(), vi)
# Switch base_ring to AA if neccessary,
# since gram_schmidt needs to be able to take square roots.
# Pick orthonormal basis and transform all vertices accordingly
Expand Down

0 comments on commit 8fa37df

Please sign in to comment.