phpOMS/Math/Geometry/Shape/D3/Cuboid.php
2023-06-17 03:13:39 +02:00

59 lines
1.1 KiB
PHP
Executable File

<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package phpOMS\Math\Geometry\Shape\D3
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace phpOMS\Math\Geometry\Shape\D3;
/**
* Cuboid shape.
*
* @package phpOMS\Math\Geometry\Shape\D3
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class Cuboid implements D3ShapeInterface
{
/**
* Volume
*
* @param float $a Edge
* @param float $b Edge
* @param float $h Height
*
* @return float
*
* @since 1.0.0
*/
public static function getVolume(float $a, float $b, float $h) : float
{
return $a * $b * $h;
}
/**
* Surface area
*
* @param float $a Edge
* @param float $b Edge
* @param float $h Height
*
* @return float
*
* @since 1.0.0
*/
public static function getSurface(float $a, float $b, float $h) : float
{
return 2 * ($a * $b + $a * $h + $b * $h);
}
}