SymPy | Polyhedron.vertices() in Python
Last Updated :
27 Aug, 2019
Polyhedron.vertices() : vertices() is a sympy Python library function that returns the vertices of the polyhedra.
Syntax : sympy.combinatorics.Polyhedrons.Polyhedron.vertices()
Return : vertices of the Polyhedron.
Code #1 : vertices() Example – tetrahedron
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.polyhedron import tetrahedron, octahedron
a = tetrahedron.copy()
print ( "Polyhedron - vertices form : " , a.vertices)
a.rotate( 0 )
print ( "\nPolyhedron - vertices form : " , a.vertices)
|
Output :
Polyhedron – vertices form : (0, 1, 2, 3)
Polyhedron – vertices form : (0, 2, 3, 1)
Code #2 : vertices() Example – octahedron
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.polyhedron import tetrahedron, octahedron
a = octahedron.copy()
print ( "Polyhedron - vertices form : " , a.vertices)
a.rotate( 0 )
print ( "\nPolyhedron - vertices form : " , a.vertices)
|
Output :
Polyhedron – vertices form : (0, 1, 2, 3, 4, 5)
Polyhedron – vertices form : (0, 2, 3, 4, 1, 5)
Share your thoughts in the comments
Please Login to comment...