Saturday, November 16, 2024
Google search engine
HomeLanguagesSymPy | Polyhedron.vertices() in Python

SymPy | Polyhedron.vertices() in Python

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




# Python code explaining
# SymPy.Polyhedron.vertices()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.polyhedron import tetrahedron, octahedron
  
# Using from 
# sympy.combinatorics.polyhedron.Polyhedron.vertices()
  
# Creating Polyhedron
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




# Python code explaining
# SymPy.Polyhedron.vertices()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.polyhedron import tetrahedron, octahedron
  
# Using from 
# sympy.combinatorics.polyhedron.Polyhedron.vertices()
  
# Creating Polyhedron
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)

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments