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

Commit

Permalink
Polyhedron_base.affine_hull_manifold: Finish
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Apr 15, 2021
1 parent 6f30843 commit 0538280
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions src/sage/geometry/polyhedron/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10421,9 +10421,25 @@ def affine_hull_manifold(self, name=None, latex_name=None, start_index=0, ambien
sage: triangle = Polyhedron([(1,0,0), (0,1,0), (0,0,1)]); triangle
A 2-dimensional polyhedron in ZZ^3 defined as the convex hull of 3 vertices
sage: triangle.affine_hull_manifold()
sage: A = triangle.affine_hull_manifold(name='A'); A
2-dimensional differentiable submanifold A embedded in the Euclidean space E^3
sage: A.embedding().display()
A --> E^3
(x0, x1) |--> (x, y, z) = (x0, x1, -x0 - x1 + 1)
sage: A.embedding().inverse().display()
E^3 --> A
(x, y, z) |--> (x0, x1) = (x, y)
Orthogonal version::
sage: A = triangle.affine_hull_manifold(name='A', orthogonal=True); A
2-dimensional differentiable submanifold A embedded in the Euclidean space E^3
sage: A.embedding().display()
A --> E^3
(x0, x1) |--> (x, y, z) = (-1/2*x0 - 1/3*x1 + 1, 1/2*x0 - 1/3*x1, 2/3*x1)
sage: A.embedding().inverse().display()
E^3 --> A
(x, y, z) |--> (x0, x1) = (-x + y + 1, -1/2*x - 1/2*y + z + 1/2)
"""
if ambient_space is None:
Expand All @@ -10440,12 +10456,17 @@ def affine_hull_manifold(self, name=None, latex_name=None, start_index=0, ambien
names = tuple(f'x{i}' for i in range(self.dim()))
CH = H.chart(names=names)

# The inverse
A, b = self.affine_hull_projection(as_affine_map=True, **kwds)


#phi = H.continuous_map(ambient_space, {(CH, CE): ....}
#H.set_embedding()
data = self.affine_hull_projection(return_all_data=True, **kwds)
projection_linear_map, projection_translation_vector = data['projection_map']
projection_matrix = projection_linear_map.matrix().transpose()
section_linear_map, section_translation_vector = data['section_map']
section_matrix = section_linear_map.matrix().transpose()

phi = H.continuous_map(ambient_space, {(CH, CE):
(section_matrix * vector(CH._xx) + section_translation_vector).list()})
phi_inv = ambient_space.continuous_map(H, {(CE, CH):
(projection_matrix * vector(CE._xx) + projection_translation_vector).list()})
H.set_embedding(phi, inverse=phi_inv)
return H

def _polymake_init_(self):
Expand Down

0 comments on commit 0538280

Please sign in to comment.