What is a superellipse
A superellipse, also known as a Lamé curve after Gabriel Lamé, is a closed curve resembling the ellipse, retaining the geometric features of semi-major axis and semi-minor axis, and symmetry about them, but a different overall shape.
In the Cartesian coordinate system, the set of all points (x, y) on the curve satisfy the equation
where n, a and b are positive numbers, and the vertical bars | | around a number indicate the absolute value of the number.
There are many number of specific cases of superellipse like given in the image down below:
These can be achieved by varying the value of n in the equation. So now we try to implement this in python and to do that we are require some libraries.
- matplotlib: To plot the curve of the equation. Its an 3rd party library in python and if you want to install it click here.
- math : Its an built in library of python which have almost all the mathematical tools.
Now let’s see what happens when we changes the value of n to 0.5
Source Code of the program in Java.
This article is contributed by Subhajit Saha. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Implementing Photomosaics
- Implementing Web Scraping in Python with BeautifulSoup
- Python | Implementing 3D Vectors using dunder methods
- Implementing Artificial Neural Network training process in Python
- Top 5 Artificial Intelligence(AI) Predictions in 2020
- How to implement Picture in Picture (PIP) in Android?
- cin get() in C++ with Examples
- Difference between Increment and Decrement Operators
- Simplified International Data Encryption Algorithm (IDEA)
- Find Kth smallest value for b such that a + b = a | b
- Number of pairs of lines having integer intersection points
- Percentage change in Hemisphere volume if radius is changed
- How to discretize an Ellipse or Circle to a Polygon using C++ Graphics?
- Program to find the time remaining for the day to complete
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.