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:
kvadrik
2026-02-28 21:08:50 +02:00
committed by GitHub
parent ba286b24d6
commit 0d2a98e9f8
2 changed files with 14 additions and 0 deletions

View File

@@ -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));
}
}