where a is the width in the x-axis, b is the depth in the y-axis and c is the height in the z-axis.
Consider a point on the height of the ellipsoid such that . The plane parallel to going through the point X will intersect the ellipsoid and determine a subsection.
The volume of the resulting ellipsoidal cap is given by:
The situation is described below, where the filled cap is the volume we want to calculate.
Example 1
#include <stdio.h>#include <codecogs/maths/geometry/volume/ellipsoidal_cap.h>int main(){// the x semi-axisdouble a = 10.5;
// the y semi-axisdouble b = 5.2;
// the z semi-axisdouble c = 3;
// display the lengths of the semi-axesprintf("a = %.1lf\nb = %.1lf\nc = %.1lf\n\n", a, b, c);
// display the volume for different values of xfor(double x = c; x >= -c; x -= 0.5)printf("x = %4.1lf V = %.1lf \n",
x, Geometry::Volume::ellipsoidal_cap(x, a, b, c));
return0;
}
Output
a = 10.5
b = 5.2
c = 3.0
x = 3.0 V = 0.0
x = 2.5 V = 13.5
x = 2.0 V = 50.8
x = 1.5 V = 107.2
x = 1.0 V = 177.9
x = 0.5 V = 258.1
x = 0.0 V = 343.1
x = -0.5 V = 428.0
x = -1.0 V = 508.2
x = -1.5 V = 578.9
x = -2.0 V = 635.3
x = -2.5 V = 672.6
x = -3.0 V = 686.1
Note
the value of must satisfy the inequality .
Parameters
x
the coordinate which determines the ellipsoidal cap