Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
Tetrahedron
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 getVolume
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getSurface
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFaceArea
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * Jingga
4 *
5 * PHP Version 8.1
6 *
7 * @package   phpOMS\Math\Geometry\Shape\D3
8 * @copyright Dennis Eichhorn
9 * @license   OMS License 2.0
10 * @version   1.0.0
11 * @link      https://jingga.app
12 */
13declare(strict_types=1);
14
15namespace phpOMS\Math\Geometry\Shape\D3;
16
17/**
18 * Tetraedron shape.
19 *
20 * @package phpOMS\Math\Geometry\Shape\D3
21 * @license OMS License 2.0
22 * @link    https://jingga.app
23 * @since   1.0.0
24 */
25final class Tetrahedron implements D3ShapeInterface
26{
27    /**
28     * Volume
29     *
30     * @param float $a Edge
31     *
32     * @return float
33     *
34     * @since 1.0.0
35     */
36    public static function getVolume(float $a) : float
37    {
38        return $a ** 3 / (6 * \sqrt(2));
39    }
40
41    /**
42     * Surface area
43     *
44     * @param float $a Edge
45     *
46     * @return float
47     *
48     * @since 1.0.0
49     */
50    public static function getSurface(float $a) : float
51    {
52        return \sqrt(3) * $a ** 2;
53    }
54
55    /**
56     * Lateral surface area
57     *
58     * @param float $a Edge
59     *
60     * @return float
61     *
62     * @since 1.0.0
63     */
64    public static function getFaceArea(float $a) : float
65    {
66        return \sqrt(3) / 4 * $a ** 2;
67    }
68}