ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 19 Jun 2021 16:19:46 +0200How to obtain the vertices of the faces of a polyhedron in the cycling order ?https://ask.sagemath.org/question/57483/how-to-obtain-the-vertices-of-the-faces-of-a-polyhedron-in-the-cycling-order/ I wanted to transfer informations from sagemath to Asymptote and draw the faces of a dodecahedron. So according to the documentation I code
Dodec=polytopes.dodecahedron()
F1 = Dodec.faces(2)
fa=[f.ambient_V_indices() for f in F1]
fa
Vdodec=Dodec.Vrepresentation()
Sdodec=[(round(Vdodec[i][0],2),round(Vdodec[i][1],2),round(Vdodec[i][2],2)) for i in range(len(Vdodec))]
show("fa= ",fa)
show("points = ",Sdodec)
If I have understood the documentation `fa` gives the vertices implied in a face. Those vertices are numbered according to the order of the `Vrepresentation()` of `Dodec` as written in the doc :
` "The faces are printed in shorthand notation where each integer is the index of a vertex/ray/line in the same order as the containing Polyhedron’s Vrepresentation()"`. So (15,16,17,18,19) is a face composed of the points :
p15=(-0.76, 0.76, -0.76),
p16=(-0.76, -0.76, -0.76),
p17=(-1.24, 0.47, 0.0),
p18=(-1.24, -0.47, 0.0),
p19=(-0.47, 0.0, -1.24),
And this is true. But here comes the problem : as I understand it, the face should be the closed cycle `p15--p16--p17--p18--p19`. But transfered in Asymptote, I discovered that the true order should be
`p15--p19--p16--p18--p17`. The same type of error seems to be the case for each face (good composition but bad order).
So here is my question : is there a command which gives the good order of the vertices which define a face or is it an error because the vertices should be given in the good order ?
(Hope that this time there is no element missing in the code)
Tue, 08 Jun 2021 16:21:24 +0200https://ask.sagemath.org/question/57483/how-to-obtain-the-vertices-of-the-faces-of-a-polyhedron-in-the-cycling-order/Answer by FrédéricC for <p>I wanted to transfer informations from sagemath to Asymptote and draw the faces of a dodecahedron. So according to the documentation I code</p>
<pre><code>Dodec=polytopes.dodecahedron()
F1 = Dodec.faces(2)
fa=[f.ambient_V_indices() for f in F1]
fa
Vdodec=Dodec.Vrepresentation()
Sdodec=[(round(Vdodec[i][0],2),round(Vdodec[i][1],2),round(Vdodec[i][2],2)) for i in range(len(Vdodec))]
show("fa= ",fa)
show("points = ",Sdodec)
</code></pre>
<p>If I have understood the documentation <code>fa</code> gives the vertices implied in a face. Those vertices are numbered according to the order of the <code>Vrepresentation()</code> of <code>Dodec</code> as written in the doc :</p>
<p><code>"The faces are printed in shorthand notation where each integer is the index of a vertex/ray/line in the same order as the containing Polyhedron’s Vrepresentation()"</code>. So (15,16,17,18,19) is a face composed of the points :</p>
<pre><code>p15=(-0.76, 0.76, -0.76),
p16=(-0.76, -0.76, -0.76),
p17=(-1.24, 0.47, 0.0),
p18=(-1.24, -0.47, 0.0),
p19=(-0.47, 0.0, -1.24),
</code></pre>
<p>And this is true. But here comes the problem : as I understand it, the face should be the closed cycle <code>p15--p16--p17--p18--p19</code>. But transfered in Asymptote, I discovered that the true order should be
<code>p15--p19--p16--p18--p17</code>. The same type of error seems to be the case for each face (good composition but bad order).</p>
<p>So here is my question : is there a command which gives the good order of the vertices which define a face or is it an error because the vertices should be given in the good order ?</p>
<p>(Hope that this time there is no element missing in the code)</p>
https://ask.sagemath.org/question/57483/how-to-obtain-the-vertices-of-the-faces-of-a-polyhedron-in-the-cycling-order/?answer=57486#post-id-57486Peut-etre via
https://doc.sagemath.org/html/en/reference/discrete_geometry/sage/geometry/polyhedron/plot.html#sage.geometry.polyhedron.plot.cyclic_sort_vertices_2dTue, 08 Jun 2021 20:46:26 +0200https://ask.sagemath.org/question/57483/how-to-obtain-the-vertices-of-the-faces-of-a-polyhedron-in-the-cycling-order/?answer=57486#post-id-57486Comment by slelievre for <p>Peut-etre via
<a href="https://doc.sagemath.org/html/en/reference/discrete_geometry/sage/geometry/polyhedron/plot.html#sage.geometry.polyhedron.plot.cyclic_sort_vertices_2d">https://doc.sagemath.org/html/en/refe...</a></p>
https://ask.sagemath.org/question/57483/how-to-obtain-the-vertices-of-the-faces-of-a-polyhedron-in-the-cycling-order/?comment=57632#post-id-57632@Cyrille -- it's a good idea to post your solution as an answer.Sat, 19 Jun 2021 16:19:46 +0200https://ask.sagemath.org/question/57483/how-to-obtain-the-vertices-of-the-faces-of-a-polyhedron-in-the-cycling-order/?comment=57632#post-id-57632Comment by Cyrille for <p>Peut-etre via
<a href="https://doc.sagemath.org/html/en/reference/discrete_geometry/sage/geometry/polyhedron/plot.html#sage.geometry.polyhedron.plot.cyclic_sort_vertices_2d">https://doc.sagemath.org/html/en/refe...</a></p>
https://ask.sagemath.org/question/57483/how-to-obtain-the-vertices-of-the-faces-of-a-polyhedron-in-the-cycling-order/?comment=57561#post-id-57561The suggestion is a good start but not the way to find it. If some one is interested I have a solution.Tue, 15 Jun 2021 16:08:53 +0200https://ask.sagemath.org/question/57483/how-to-obtain-the-vertices-of-the-faces-of-a-polyhedron-in-the-cycling-order/?comment=57561#post-id-57561