📜  SymPy | Python中的 Polyhedron.faces()

📅  最后修改于: 2022-05-13 01:54:42.885000             🧑  作者: Mango

SymPy | Python中的 Polyhedron.faces()

Polyhedron.faces() : faces()是一个 sympy Python库函数,它返回多面体的面。

代码 #1:faces() 示例——四面体

# Python code explaining
# SymPy.Polyhedron.faces()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.polyhedron import tetrahedron, octahedron
  
# Using from 
# sympy.combinatorics.polyhedron.Polyhedron.faces()
  
# Creating Polyhedron
a = tetrahedron.copy()
  
print ("Polyhedron - faces form : ", a.faces)
  
a.rotate(0)
print ("\nPolyhedron - faces form : ", a.faces)

输出 :

代码 #2 : faces() 示例 – 八面体

# Python code explaining
# SymPy.Polyhedron.faces()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.polyhedron import tetrahedron, octahedron
  
# Using from 
# sympy.combinatorics.polyhedron.Polyhedron.faces()
  
# Creating Polyhedron
a = octahedron.copy()
  
print ("Polyhedron - faces form : ", a.faces)
  
a.rotate(0)
print ("\nPolyhedron - faces form : ", a.faces)

输出 :