Ask Your Question
0

Computing projection of a polyhedron

asked 2019-10-02 19:08:37 -0600

Max Alekseyev gravatar image

How to compute the projection of a given polyhedron onto a given smaller-dimensional plane?

E.g., the projection of Polyhedron(vertices=[(-1,-1), (1,3), (5,-2)]) onto the line $y=x$.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-10-25 17:17:43 -0600

jipilab gravatar image

One possibility is the following.

First create the desired transformation as a matrix.

sage: nf = QuadraticField(2)
sage: sqrt2 = nf.gen()
sage: proj_mat = matrix(nf,[[sqrt2/2,sqrt2/2],[sqrt2/2,sqrt2/2]])

Then, create your polyhedron

sage: P = Polyhedron(vertices=[(-1,-1), (1,3), (5,-2)])

One then just need to apply the transformation on each vertices of the polyhedron and take the result back to a polyhedron.

sage: Pproj = Polyhedron(vertices = (proj_mat*P.vertices_matrix()).columns())
sage: Pproj
A 1-dimensional polyhedron in (Number Field in a with defining polynomial x^2 - 2)^2 defined as the convex hull of 2 vertices
sage: Pproj.vertices_list()
[[-a, -a], [2*a, 2*a]]

Currently, projections (or other linear transformations) are not implemented better than as above...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-10-02 19:08:37 -0600

Seen: 22 times

Last updated: Oct 25