Ellipse
An ellipse is a closed curve made up of points whose distances from two fixed points (foci) all add up to the same number. The center is the location where the foci meet in the middle. An ellipse’s property is that a line reflected off its border from one focus will pass through the other.
class sympy.geometry.ellipse.Ellipse(center=None, hradius=None, vradius=None, eccentricity=None, **kwargs)
Equation of the ellipse can be constructed with the equation() method, it takes symbols as inputs. .area property is used to display the area of the circle and the .circumference attribute is used to find the circumference of the circle.
Python3
# importing packages from sympy.geometry import Ellipse, Point from sympy.abc import x, y # ellipse ellipse = Ellipse(Point( 0 , 0 ), 5 , 8 ) # area of ellipse print ( 'area of the ellipse is : ' + str (ellipse.area)) # equation of ellipse print ( 'equation of the ellipse is : ' ) print (ellipse.equation(x, y)) # circumference of ellipse print ('circumference of the ellipse is : \ ' + str (ellipse.circumference)) |
Output:
area of the ellipse is : 40*pi equation of the ellipse is : x**2/25 + y**2/64 - 1 circumference of the ellipse is : 32*elliptic_e(39/64)
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.