mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-12 10:18:39 +00:00
92 lines
1.7 KiB
PHP
92 lines
1.7 KiB
PHP
<?php
|
|
/**
|
|
* Orange Management
|
|
*
|
|
* PHP Version 7.0
|
|
*
|
|
* @category TBD
|
|
* @package TBD
|
|
* @author OMS Development Team <dev@oms.com>
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
* @copyright 2013 Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link http://orange-management.com
|
|
*/
|
|
namespace phpOMS\Math\Algebra;
|
|
|
|
/**
|
|
* Circle shape.
|
|
*
|
|
* @category Framework
|
|
* @package phpOMS\DataStorage\Database
|
|
* @author OMS Development Team <dev@oms.com>
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
* @license OMS License 1.0
|
|
* @link http://orange-management.com
|
|
* @since 1.0.0
|
|
*/
|
|
class Circle
|
|
{
|
|
|
|
/**
|
|
* Area
|
|
*
|
|
* @param float $r Radius
|
|
*
|
|
* @return float
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public static function getArea(float $r)
|
|
{
|
|
return pi() * $r ** 2;
|
|
}
|
|
|
|
/**
|
|
* Circumference
|
|
*
|
|
* @param float $r Radius
|
|
*
|
|
* @return float
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public static function getCircumference(float $r)
|
|
{
|
|
return 2 * pi() * $r;
|
|
}
|
|
|
|
/**
|
|
* Radius
|
|
*
|
|
* @param float $area Area
|
|
*
|
|
* @return float
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public static function getRadiusByArea(float $area)
|
|
{
|
|
return sqrt($area / pi());
|
|
}
|
|
|
|
/**
|
|
* Radius
|
|
*
|
|
* @param float $C Circumference
|
|
*
|
|
* @return float
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public static function getRadiusByCircumference(float $C)
|
|
{
|
|
return $C / (2 * pi());
|
|
}
|
|
}
|