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.

Similar Reads

Points

A location is a point in geometry. It has no dimensions, i.e. no width, length, or depth. A dot represents a point. Collinearity is the property of a set of points lying on a single line in geometry. Collinearity refers to a group of points that have this property. Point() function is used to create a point in space. Point class contains the distance() method to find the distance between two points....

Line

...

Triangle

...

Polygon

A line is defined as a set of points that stretches in two directions indefinitely. It just has one dimension, which is length. Line() is created with the help of two points. intersection() method is used to find the point of intersection between two lines. angle_between() function is used to find angles between two lines....

Circle

...

Ellipse

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....

Contact Us