Opened 6 years ago
Closed 5 years ago
#15547 closed defect (fixed)
Fix the creation of tikzpictures of projections of polytopes
Reported by:  jipilab  Owned by:  

Priority:  major  Milestone:  sage6.3 
Component:  geometry  Keywords:  tikz, projection 
Cc:  Merged in:  
Authors:  JeanPhilippe Labbé  Reviewers:  Volker Braun 
Report Upstream:  N/A  Work issues:  
Branch:  eedb8b3 (Commits)  Commit:  eedb8b3edf7d704ddd6e66d82dc4efb62e534be8 
Dependencies:  Stopgaps: 
Description (last modified by )
Right now, the tikz method for the projection of a 2d polytope in 3d relies on the dimension of the projection and not the dimension of the actual polytope. This is incompatible with the way that the tikz method works in this case. Moreover, the drawing of backedges of 3dpolytopes (in 3d) is broken.
The first error can be reproduced:
sage: P = Polyhedron(vertices=[[1,0,0],[0,1,0],[0,0,1]]) sage: P.ambient_dim() 3 sage: P.dim() 2 sage: PProj = P.projection() sage: PProj.polyhedron_ambient_dim 3 sage: PProj.dimension 3
To fix the issue, I believe one should add an attribute "polyhedron_dim" to the projection to know what the dimension of the polyhedron actually is. Something like:
sage: PProj.polyhedron_dim 2
Then the tikz method will use this attribute to decide which algorithm to apply.
The second problem is an indexing issue in the creation of potential back edges. There is a trivial fix to that.
The doc of _init_from_2d and _init_from_3d should also mention that it is possible to have lower dimensional polytopes.
Change History (17)
comment:1 Changed 6 years ago by
 Description modified (diff)
 Summary changed from Dimension of a projection of a polyhedron to Dimension of a projection of a polyhedron/TikZ method for polyhedron
comment:2 Changed 6 years ago by
 Milestone changed from sage6.2 to sage6.3
comment:3 Changed 5 years ago by
 Branch set to u/jipilab/ticket15547
comment:4 Changed 5 years ago by
 Commit set to 9e06c77e6b641ff54bdde4faad541872a6256da1
comment:5 Changed 5 years ago by
 Commit changed from 9e06c77e6b641ff54bdde4faad541872a6256da1 to 270e115a2fa376e8a48dc13345c8837b4bd62086
Branch pushed to git repo; I updated commit sha1. New commits:
270e115  Added an attribute to projection for test to pass

comment:6 Changed 5 years ago by
 Status changed from new to needs_review
comment:7 Changed 5 years ago by
 Priority changed from minor to major
comment:8 Changed 5 years ago by
Humm, looks good enough to me, but you have not solved the issue raised in the description of the ticket. Maybe you could just change this description, and maybe also add a little more doc to _init_from_2d
and _init_from_3d
(explaining that the first one takes 2dpolygons in 2d as input and the second one only takes 3dpolytopes in 3d as input ; and also that no check is done that the dimension of the input is correct)
comment:9 Changed 5 years ago by
 Description modified (diff)
 Status changed from needs_review to needs_work
 Summary changed from Dimension of a projection of a polyhedron/TikZ method for polyhedron to Fix the creation of tikzpictures of projections of polytopes
comment:10 Changed 5 years ago by
 Commit changed from 270e115a2fa376e8a48dc13345c8837b4bd62086 to 26045b67c8afb164dc00ee510b1f33a8f97105f0
Branch pushed to git repo; I updated commit sha1. New commits:
26045b6  Added and corrected doc in methods related to tikz and the projection init method

comment:11 Changed 5 years ago by
 Description modified (diff)
 Status changed from needs_work to needs_review
comment:12 Changed 5 years ago by
 Commit changed from 26045b67c8afb164dc00ee510b1f33a8f97105f0 to 328ac2d4f82a76b6d66b2ef05a7b994b2663cbfd
Branch pushed to git repo; I updated commit sha1. New commits:
328ac2d  Removed unnecessary spaces

comment:13 Changed 5 years ago by
 Commit changed from 328ac2d4f82a76b6d66b2ef05a7b994b2663cbfd to eedb8b3edf7d704ddd6e66d82dc4efb62e534be8
Branch pushed to git repo; I updated commit sha1. New commits:
eedb8b3  Remove another unnecessary space

comment:14 Changed 5 years ago by
Looks good to me. Are you finished editing? ;)
comment:15 Changed 5 years ago by
Yes! Finally!! :)
comment:16 Changed 5 years ago by
 Reviewers set to Volker Braun
 Status changed from needs_review to positive_review
"Author" trac field must be full name, for the record
comment:17 Changed 5 years ago by
 Branch changed from u/jipilab/ticket15547 to eedb8b3edf7d704ddd6e66d82dc4efb62e534be8
 Resolution set to fixed
 Status changed from positive_review to closed
I uploaded a patch.
The problem is now solved and I added two examples to test the bug on back edges of 3d polytopes and the drawing of 2dpolytopes embedded in 3d.
On this patch, the examples of projections have to be solved... (tests do not pass)
New commits:
Ticket 15547: correct the dimension of projection and 3dbackedges in tikz method