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

Commit

Permalink
Trac #27366 compute coordinate images
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrenn committed Mar 7, 2019
1 parent 6cf71c7 commit 477923b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/sage/geometry/polyhedron/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6985,6 +6985,17 @@ def affine_hull(self, as_polyhedron=None, as_affine_map=False,
if as_affine_map:
L = linear_transformation(A, side='right')
result['affine_map'] = (L, -A*vector(A.base_ring(), self.vertices()[0]))
if return_all_data:
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
# columns of W are equal to the vertices of affine_hull['polyhedron']
# in an order compatible with the vectors vi
W = matrix([list(L(v)) for v in vi]).transpose()

# transform the coordinates
t = vector(PolynomialRing(self.base_ring(), 't', len(vi)).gens())
beta = W.inverse() * t
coordinate_images = v0 + sum(b * v for b, v in zip(beta, vi))
result['coordinate_images'] = tuple(coordinate_images)

else:
# translate one vertex to the origin
Expand Down

0 comments on commit 477923b

Please sign in to comment.