SymPy Python中的Polyhedron.rotate()

SymPy Python中的Polyhedron.rotate()

Polyhedron.rotate() : rotate()是一个Sympy Python库函数,可以围绕多面体的一个轴进行旋转。

语法 : sympy.combinatorics.Polyhedrons.Polyhedron.rotate()

返回:围绕多面体的一个轴线的旋转

代码 #1 : rotate() 示例 – 四面体

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

输出 :

Polyhedron – rotate form : [0, 1, 2, 3]

Polyhedron – rotate form : [0, 2, 3, 1]

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

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

输出 :

Polyhedron – rotate form : [0, 1, 2, 3, 4, 5]

Polyhedron – rotate form : [0, 2, 3, 4, 1, 5]

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程