Say I have a superellipse with a given width, height and eccentricity (n). I want to create x horizontal slices of equal height. How can I calculate the area of each slice?
I don't even need exact values for the specific project I'm working on, only close approximations.
You can make integral for area of superellipse slice like this (4) and integrate it numerically in needed range instead of 0..a
I think that for approximation simple method of midpoint rectangles is enough:
for slice interval y0..y1
choose number of sub intervals n
, step h = (y1-y0)/n
and calculate function value (y instead of x) in points y0 + h/2 + h*i, i = 0..n-1
, then sum these values and multiply sum by y1-y0
.