Sage中多面体对象的可视化¶
有不同的方法来可视化多面体对象的维度最多4。
render_solid
¶
这会将多面体打印为实体。您还可以调整 opacity
参数。
sage: Cube = polytopes.cube()
sage: Cube.render_solid(opacity=0.7)
Graphics3d Object
render_wireframe
¶
这将绘制多面体的图形(具有无界边)
sage: Cube.render_wireframe()
Graphics3d Object
plot
¶
这个 plot
方法将图形、多边形和多面体的顶点绘制在一起。
sage: Cube.plot()
Graphics3d Object
show
¶
这类似于 plot
但不返回您可以操作的对象。
schlegel_projection
¶
使用施莱格尔图可以可视化四维多面体。
sage: HC = polytopes.hypercube(4)
sage: HC.schlegel_projection()
The projection of a polyhedron into 3 dimensions
sage: HC.schlegel_projection().plot()
Graphics3d Object
通过选择不同距离的点,我们可以从不同的角度看到它:
sage: HC.schlegel_projection(position=1/4).plot()
Graphics3d Object
可以选择从哪个方面看到投影:
sage: tHC = HC.face_truncation(HC.faces(0)[0])
sage: tHC.facets()
(A 3-dimensional face of a Polyhedron in QQ^4 defined as the convex hull of 10 vertices,
A 3-dimensional face of a Polyhedron in QQ^4 defined as the convex hull of 10 vertices,
A 3-dimensional face of a Polyhedron in QQ^4 defined as the convex hull of 10 vertices,
A 3-dimensional face of a Polyhedron in QQ^4 defined as the convex hull of 10 vertices,
A 3-dimensional face of a Polyhedron in QQ^4 defined as the convex hull of 4 vertices,
A 3-dimensional face of a Polyhedron in QQ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in QQ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in QQ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in QQ^4 defined as the convex hull of 8 vertices)
sage: tHC.schlegel_projection(tHC.facets()[4]).plot()
Graphics3d Object
tikz
¶
此方法返回多面体的tikz图片(必须是2维或3维)。有关更多详细信息,请参阅教程 使用TikZ在LaTeX中绘制多边形 。
sage: c = polytopes.cube()
sage: c.tikz(output_type='TikzPicture')
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}%
[x={(1.000000cm, 0.000000cm)},
y={(-0.000000cm, 1.000000cm)},
z={(0.000000cm, -0.000000cm)},
scale=1.000000,
...
Use print to see the full content.
...
\node[vertex] at (-1.00000, -1.00000, 1.00000) {};
\node[vertex] at (-1.00000, 1.00000, 1.00000) {};
%%
%%
\end{tikzpicture}
\end{document}