Triangle
A triangle is a three-sided polygon with three vertices and three edges. It is one of the most fundamental geometric forms. Triangle is formed with the help of three points or vertices. .area property is used to find the area of the triangle.
Triangle(vertex1,vertex2,vertex3)
Python3
# importing packages from sympy.geometry import Point, Triangle # constructing a triangle with three points triangle = Triangle(Point( 0 , 0 ), Point( 3 , 0 ), Point( 3 , 3 )) # area of the triangle print ( 'area of the triangle is : ' + str (triangle.area)) |
Output:
area of the triangle is : 9/2
What are Entities in SymPy?
The geometry module in SymPy is the foundation class for all geometrical entities Python, allowing you to create two-dimensional objects like lines and circles, polygons, etc. Then we may find out more about it by looking for collinearity or detecting intersections. Any object with particular geometric qualities is referred to as a GeometryEntity.
class sympy.geometry.entity.GeometryEntity(*args, **kwargs)
All geometrical entities inherit from this basic class. This class does not represent any specific geometric entity; instead, it implements several methods that are shared by all subclasses.
Contact Us