-
-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Schlegel projection breaks convexity #30015
Comments
comment:1
Is this the bug you showed during your presentation at sd109? |
Commit: |
This comment has been minimized.
This comment has been minimized.
Author: Jean-Philippe Labbé |
Branch: u/jipilab/schlegel |
comment:3
Replying to @kliem:
? |
comment:4
Replying to @kliem:
No, that one had to do with plotting in 3d and having missing faces or so. This one is really different: it was providing a wrong output. Further, the method is improved and made more user-friendly, one just needs to be fed a facet and a positive number to get a schlegel diagram. Close to 0, the projection point is very close to the barycenter of the facet, otherwise, getting away in the direction of the representative point of the locus of points that see that facet. Given these 2 things, this provides a projection of the polyhedron (think typically of something in 4d) into the affine hull of the facet, and that image is then transformed orthonormally into 3d and then the picture is drawn. |
comment:5
Ach...
That line is an overkill... I should probably change it to something a bit simpler than taking the intersection. The problem occurs prior to this, this is an artefact from the older version, somehow it is already converted to RDF before and then no intersection is found. This example is likely to be one the extreme side, but it is good to fix this now. |
comment:6
Replying to @jplab:
In Ziegler's book (Lectures on Polytopes) page 133, there is a nice formula for computing the intersection point. |
comment:7
Replying to @LaisRast:
Thanks for the pointer, that will do. There is still the issue that at that moment, one deals already with |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:9
I still get an error at line 917 in |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:11
That should do it. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:20
Replying to @kliem:
Defaulting behavior will never be perfect.
It was a mere coincidence that it was orthonormally projected by the method show (!). In this case, this is a different ticket fixing the |
This comment has been minimized.
This comment has been minimized.
comment:21
Thank you for exposing the Of course default behavior will never be perfect, but it is stupid to be stuck with an awful default and don't know how to change it. If I'm now unhappy with the default, I can inspect the
How about adding diff --git a/src/sage/geometry/polyhedron/base.py b/src/sage/geometry/polyhedron/base.py
index 59eeb0aa41..f3551f6045 100644
--- a/src/sage/geometry/polyhedron/base.py
+++ b/src/sage/geometry/polyhedron/base.py
@@ -1040,6 +1040,8 @@ class Polyhedron_base(Element):
elif polyhedron.dimension() == 4:
# There is no 4-d screen, we must project down to 3d
return polyhedron.schlegel_projection(position=position)
+ elif polyhedron.dim() <= 3:
+ return polyhedron.affine_hull_projection(orthonormal=True, extend=True).projection()
else:
return polyhedron.projection() to this ticket? Then this won't be a regression in that way. |
comment:22
Replying to @jplab:
But you have introduced a change in this ticket, this is why I propose to "fix" it here. At least some temporary solution we can live with. The default plotting method before this ticket for |
comment:23
Ok sure. But again: it was not doing an orthonormal projection, otherwise the minimal non-working example in the ticket description would not occur. It was a mere accident because the permutahedron realization given there is inscribed. The above addition looks good to me. I would even prioritize it over I'll have another round of look at it. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:25
It should be all fixed now. I changed the default behavior for when the locus polyhedron is compact, to take the midpoint of the line segment. The rest is unchanged. Further, I exposed the option to remove orthonormality in the plotting... Have a look at:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:27
... Ok. So ready for review again... It should be a small improvement on the plotting procedure. To me it makes more sense as of now. (see the internal |
comment:28
- def project(polyhedron,ortho):
+ def project(polyhedron, ortho): - projection = project(self,orthonormal)
+ projection = project(self, orthonormal) I propose the following doctest to show that this has been fixed::
This line here is hard to read due to the underscore. I would exchange it for something else:
+ A, b = self.facet.as_polyhedron().affine_hull_projection(as_affine_map=True, orthonormal=True,extend=True)
- A,b = self.facet.as_polyhedron().affine_hull_projection(as_affine_map=True, orthonormal=True, extend=True) - self.projection_point = vector(RDF,projection_point)
+ self.projection_point = vector(RDF, projection_point) |
comment:29
Once done, you can put it on positive review on my behalf. Thank you for fixing this. It's great to have this. |
Reviewer: Jonathan Kliem |
comment:30
With your ticket, how do I obtain a decent picture of Or maybe one should really choose better points on the moment curve for pictures. The pairwise euclidean distance of the vertices behaves awful. |
comment:31
I guess you can basically forget the last comment. It is just to note that the current realization doesn't work for pictures. Anyway, if you agree to the changes I suggested, I can also do them. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:34
Replying to @kliem:
There isn't really any good choice of parameters to get "a nice picture" of the cyclic polytope on the moment curve. A better choice would be to essentially add the cyclic polytope construction on the trigonometric curve so that the coordinates all have the same "scale". ... another nice thing that would be easy to implement and that's not too hard. |
comment:35
Typos, to be fixed here or in a follow-up ticket. - A different values of ``position`` changes the projection::
+ A different value of ``position`` changes the projection:: - sees more than one facet resulting in a error::
+ sees more than one facet resulting in an error:: |
Changed branch from u/jipilab/schlegel to |
The documentation string of
.schlegel_projection
reads:When normalizing to the unit sphere this (potentially) completely breaks the convexity of the object.
Minimal example:
The pentagons are not planar although they should in a schlegel diagram.
The scaling to the unit sphere should be removed to preserve convexity.
This ticket fixes the projection while de-duplicating some code.
FOLLOW-UP: Fix .plot() and .show() to have a better behaviour of smaller dimensional objects.
CC: @kliem @LaisRast
Component: geometry
Keywords: polytope, schlegel
Author: Jean-Philippe Labbé
Branch/Commit:
f10d571
Reviewer: Jonathan Kliem
Issue created by migration from https://trac.sagemath.org/ticket/30015
The text was updated successfully, but these errors were encountered: