mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
Added volume of a torus (#7294)
* Added volume of a torus Added function calculation the volume of a torus according to the formula: V = 2 * pi^2 * R * r^2 where R is the major radius and r is the minor radius of the torus. * Added test for torus volume
This commit is contained in:
@@ -38,5 +38,8 @@ public class VolumeTest {
|
||||
|
||||
/* test pyramid frustum */
|
||||
assertEquals(140.0, Volume.volumeFrustumOfPyramid(6, 24, 10));
|
||||
|
||||
/* test torus */
|
||||
assertEquals(39.47841760435743, Volume.volumeTorus(2, 1));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user