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 firstname.lastname@example.org. 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.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- 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 10 Machine Learning Project Ideas That You Can Implement
- Count of Root to Leaf Paths consisting of at most M consecutive Nodes having value K
- Maximum number of operations required such that no pairs from a Matrix overlap
- Top 5 Golang Frameworks in 2020
- Queries to count characters having odd frequency in a range [L, R]
- Queries to find the XOR of an Array after replacing all occurrences of X by Y
- Minimum Sum of a pair at least K distance apart from an Array
- Maximize length of the String by concatenating characters from an Array of Strings
- Find the amplitude and number of waves for the given array
- Maximum sum of any submatrix of a Matrix which is sorted row-wise and column-wise
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 Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.