Hi there, could anyone help me building surface like x^2/625 + y^2/64 + z^2 = 1?
As far as I know, x would be in range of -25; 25, y range would dynamically change depending on x, and I should create 2 shapes, one for z = Sqrt(1 - x^2/625 - y^2/81) and one for z = - Sqrt(1 - x^2/625 - y^2/81)
I tried doing something like this:
Mapper mapper = new Mapper() {
@Override
public double f(double x, double y) {
if (x < -25 || x > 25 || y < -getYRange(x) || y > getYRange(x))
return Float.NaN;
return Math.sqrt(1.0f - (x*x)/625.0f - (y*y) / 64.0f);
}
};
Mapper mapper2 = new Mapper() {
@Override
public double f(double x, double y) {
if (x < -25 || x > 25 || y < -getYRange(x) || y > getYRange(x))
return Float.NaN;
return -Math.sqrt(1.0f - (x*x)/625.0f - (y*y) / 64.0f);
}
};
getYRange(x) is a function that returns y range for each value of x.
However, after displaying the surfaces it seems like there is an empty space close to 0, therefore I can't get correct ellipsoid.
What should I do to make it correct?