Forgotten Password?

Or login with:

• http://facebook.com/
• https://www.google.com/accounts/o8/id
• https://me.yahoo.com
COST (GBP)
1.00
0.00
0

# ellipsoidal cap

Computes the volume of an ellipsoidal cap.
Controller: CodeCogs

C++

## Ellipsoidal Cap

 doubleellipsoidal_cap( double x double a double b double c )[inline]
This module calculates the volume of an ellipsoidal cap.

The general equation for the ellipsoid is:
$\frac{x^2}{a^2}&space;+&space;\frac{y^2}{b^2}&space;+&space;\frac{z^2}{c^2}&space;=&space;1$

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 $\inline&space;X(0,0,x)$ a point on the height of the ellipsoid such that $\inline&space;&space;-c&space;\leq&space;x&space;\leq&space;c$. The plane parallel to $\inline&space;xOy$ going through the point X will intersect the ellipsoid and determine a subsection.

The volume of the resulting ellipsoidal cap is given by:
$V&space;=&space;\pi&space;a&space;b\left(&space;\frac{2c}{3}&space;-&space;x&space;+&space;\frac{x^3}{3c^2}\right)$

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-axis
double a = 10.5;

// the y semi-axis
double b = 5.2;

// the z semi-axis
double c = 3;

// display the lengths of the semi-axes
printf("a = %.1lf\nb = %.1lf\nc = %.1lf\n\n", a, b, c);

// display the volume for different values of x
for (double x = c; x >= -c; x -= 0.5)
printf("x = %4.1lf    V = %.1lf \n",
x, Geometry::Volume::ellipsoidal_cap(x, a, b, c));

return 0;
}
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 $\inline&space;&space;x$ must satisfy the inequality $\inline&space;&space;-c&space;\leq&space;x&space;\leq&space;c$.

### Parameters

 x the coordinate which determines the ellipsoidal cap a the x semi-axis (width) b the y semi-axis (depth) c the z semi-axis (height)

### Returns

the volume of the ellipsoidal cap

### Authors

Eduard Bentea (November 2006)
##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

Last Modified: 18 Dec 11 @ 22:50     Page Rendered: 2022-03-14 17:50:54