Ellipsoid, closed surface of which all plane cross sections are either ellipses or circles. An ellipsoid is symmetrical about three mutually perpendicular axes that intersect at the center. It is a three-dimensional, closed geometric shape, all planar sections of which are ellipses or circles.
An ellipsoid has three independent axes, and is usually specified by the lengths a, b, c of the three semi-axes. If an ellipsoid is made by rotating an ellipse about one of its axes, then two axes of the ellipsoid are the same, and it is called an ellipsoid of revolution, or spheroid. If the lengths of all three of its axes are the same, it is a sphere.
Standard equation of Ellipsoid :
x2 / a2 + y2 / b2 + z2 / c2 = 1
where a, b, c are positive real numbers.
Volume of Ellipsoid : (4/3) * pi * r1 * r2 * r3
Below is code for calculating volume of ellipsoid :
C++
#include <bits/stdc++.h>
using namespace std;
float volumeOfEllipsoid( float r1,
float r2,
float r3)
{
float pi = 3.14;
return 1.33 * pi * r1 *
r2 * r3;
}
int main()
{
float r1 = 2.3, r2 = 3.4, r3 = 5.7;
cout << "volume of ellipsoid is : "
<< volumeOfEllipsoid(r1, r2, r3);
return 0;
}
|
Java
import java.util.*;
import java.lang.*;
class GfG
{
public static float volumeOfEllipsoid( float r1,
float r2,
float r3)
{
float pi = ( float ) 3.14 ;
return ( float ) 1.33 * pi * r1 * r2 * r3;
}
public static void main(String args[])
{
float r1 = ( float ) 2.3 ,
r2 = ( float ) 3.4 ,
r3 = ( float ) 5.7 ;
System.out.println( "volume of ellipsoid is : "
+ volumeOfEllipsoid(r1, r2, r3));
}
}
|
Python
import math
def volumeOfEllipsoid(r1, r2, r3):
return 1.33 * math.pi * r1 * r2 * r3
r1 = float ( 2.3 )
r2 = float ( 3.4 )
r3 = float ( 5.7 )
print ( "Volume of ellipsoid is : " ,
volumeOfEllipsoid(r1, r2, r3) )
|
C#
using System;
class GfG
{
public static float volumeOfEllipsoid( float r1,
float r2,
float r3)
{
float pi = ( float )3.14;
return ( float ) 1.33 * pi * r1 * r2 * r3;
}
public static void Main()
{
float r1 = ( float )2.3,
r2 =( float ) 3.4,
r3 = ( float )5.7;
Console.WriteLine( "volume of ellipsoid is : " +
volumeOfEllipsoid(r1, r2, r3));
}
}
|
PHP
<?php
function volumeOfEllipsoid( $r1 ,
$r2 ,
$r3 )
{
$pi = 3.14;
return 1.33 * $pi * $r1 *
$r2 * $r3 ;
}
$r1 = 2.3; $r2 = 3.4;
$r3 = 5.7;
echo ( "volume of ellipsoid is : " );
echo ( volumeOfEllipsoid( $r1 , $r2 , $r3 ));
?>
|
Javascript
<script>
function volumeOfEllipsoid( r1, r2, r3)
{
let pi = 3.14;
return 1.33 * pi * r1 *
r2 * r3;
}
let r1 = 2.3, r2 = 3.4, r3 = 5.7;
document.write( "volume of ellipsoid is : "
+ volumeOfEllipsoid(r1, r2, r3).toFixed(2));
</script>
|
Output :
Volume of ellipsoid is : 186.15