diff --git a/Math/Algebra/PointPolygonIntersection.php b/Math/Algebra/PointPolygonIntersection.php deleted file mode 100644 index 2c7aaef36..000000000 --- a/Math/Algebra/PointPolygonIntersection.php +++ /dev/null @@ -1,119 +0,0 @@ - - * @author Dennis Eichhorn - * @copyright 2013 Dennis Eichhorn - * @license OMS License 1.0 - * @version 1.0.0 - * @link http://orange-management.com - */ -namespace phpOMS\Math\Algebra; - -/** - * Scheduler factory. - * - * @category Framework - * @package phpOMS\Utils\TaskSchedule - * @author OMS Development Team - * @author Dennis Eichhorn - * @license OMS License 1.0 - * @link http://orange-management.com - * @since 1.0.0 - */ -final class PointPolygonIntersection -{ - /** - * Epsilon. - * - * @var float - * @since 1.0.0 - */ - const EPSILON = 1E-6; - - /** - * Point polygon relative position - * - * @param array $point Point location - * @param array $vertices Vertice locations - * - * @return int - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public static function pointInPolygon(array $point, array $vertices) : int - { - $length = count($vertices); - - // Polygon has to start and end with same point - if ($vertices[0]['x'] !== $vertices[$length - 1]['x'] || $vertices[0]['y'] !== $vertices[$length - 1]['y']) { - $vertices[] = $vertices[0]; - } - - // On vertex? - if (self::isOnVertex($point, $vertices)) { - return 0; - } - - // Inside or ontop? - $countIntersect = 0; - $vertices_count = count($vertices); - - // todo: return based on highest possibility not by first match - for ($i = 1; $i < $vertices_count; $i++) { - $vertex1 = $vertices[$i - 1]; - $vertex2 = $vertices[$i]; - - if (abs($vertex1['y'] - $vertex2['y']) < self::EPSILON && abs($vertex1['y'] - $point['y']) < self::EPSILON && $point['x'] > min($vertex1['x'], $vertex2['x']) && $point['x'] < max($vertex1['x'], $vertex2['x'])) { - return 0; // boundary - } - - if ($point['y'] > min($vertex1['y'], $vertex2['y']) && $point['y'] <= max($vertex1['y'], $vertex2['y']) && $point['x'] <= max($vertex1['x'], $vertex2['x']) && abs($vertex1['y'] - $vertex2['y']) >= self::EPSILON) { - $xinters = ($point['y'] - $vertex1['y']) * ($vertex2['x'] - $vertex1['x']) / ($vertex2['y'] - $vertex1['y']) + $vertex1['x']; - - if (abs($xinters - $point['x']) < self::EPSILON) { - return 0; // boundary - } - - if (abs($vertex1['x'] - $vertex2['x']) < self::EPSILON || $point['x'] < $xinters) { - $countIntersect++; - } - } - } - - if ($countIntersect % 2 != 0) { - return -1; - } - - return 1; - } - - /** - * Is point on vertex? - * - * @param array $point Point location - * @param array $vertices Vertice locations - * - * @return bool - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - private static function isOnVertex($point, $vertices) : bool - { - foreach ($vertices as $vertex) { - if (abs($point['x'] - $vertex['x']) < self::EPSILON && abs($point['y'] - $vertex['y']) < self::EPSILON) { - return true; - } - } - - return false; - } -} - diff --git a/Math/Algebra/Regression.php b/Math/Algebra/Regression.php deleted file mode 100644 index c133e2450..000000000 --- a/Math/Algebra/Regression.php +++ /dev/null @@ -1,72 +0,0 @@ - - * @author Dennis Eichhorn - * @copyright 2013 Dennis Eichhorn - * @license OMS License 1.0 - * @version 1.0.0 - * @link http://orange-management.com - */ - -namespace phpOMS\Math\Algebra; - -/** - * Regression class. - * - * @category Framework - * @package phpOMS\DataStorage\Database - * @author OMS Development Team - * @author Dennis Eichhorn - * @license OMS License 1.0 - * @link http://orange-management.com - * @since 1.0.0 - */ -class Regression -{ - /** - * Calculate linear regression. - * - * Example: ([1, 4, 6, 8, 9], [5, 3, 8, 6, 2]) - * - * @param array $x X coordinates - * @param array $y Y coordinates - * - * @return array - * - * @throws \Exception - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public static function linearRegression(array $x, array $y) : array - { - $count = count($x); - - if ($count !== count($y)) { - throw new \Exception('Dimensions'); - } - - $xSum = array_sum($x); - $ySum = array_sum($y); - - $xxSum = 0; - $xySum = 0; - - for ($i = 0; $i < $count; $i++) { - - $xySum += ($x[$i] * $y[$i]); - $xxSum += ($x[$i] * $x[$i]); - } - - $m = (($count * $xySum) - ($xSum * $ySum)) / (($count * $xxSum) - ($xSum * $xSum)); - $b = ($ySum - ($m * $xSum)) / $count; - - return ['m' => $m, 'b' => $b]; - } -} diff --git a/Math/Number/Numbers.php b/Math/Number/Numbers.php index ac49e130d..c970ec7de 100644 --- a/Math/Number/Numbers.php +++ b/Math/Number/Numbers.php @@ -62,7 +62,7 @@ class Numbers * @since 1.0.0 * @author Dennis Eichhorn */ - public static function selfdescribing(int $n) : bool + public static function isSelfdescribing(int $n) : bool { $split = str_split($n); foreach ($split as $place => $value) { diff --git a/Math/NumberType.php b/Math/NumberType.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/Math/Optimization/GaussianElimination.php b/Math/Optimization/GaussianElimination.php index 363024bff..3269d6b6d 100644 --- a/Math/Optimization/GaussianElimination.php +++ b/Math/Optimization/GaussianElimination.php @@ -42,7 +42,7 @@ class GaussianElimination * @since 1.0.0 * @author Dennis Eichhorn */ - private function swapRows(&$a, &$b, int $r1, int $r2) + private static function swapRows(&$a, &$b, int $r1, int $r2) { if ($r1 == $r2) { return; @@ -68,7 +68,7 @@ class GaussianElimination * @since 1.0.0 * @author Dennis Eichhorn */ - public function solve(Matrix $A, Matrix $b) : Matrix + public static function solve(Matrix $A, Matrix $b) : Matrix { $limit = min($A->getM(), $A->getN()); $A = $A->getMatrix(); diff --git a/Math/Optimization/TSP/BruteForce.php b/Math/Optimization/TSP/BruteForce.php index ab2047a9b..c1758c55d 100644 --- a/Math/Optimization/TSP/BruteForce.php +++ b/Math/Optimization/TSP/BruteForce.php @@ -60,7 +60,7 @@ class BruteForce $this->cityPool = $pool; if ($this->cityPool->count() > self::LIMIT) { - throw new \Exception('64 bit overflow'); + throw new \Exception('Overflow'); } } @@ -98,7 +98,7 @@ class BruteForce */ private function bruteForce(array $cities, Tour $tour, Population $population) { - if (count($cities) === 0) { + if (empty($cities)) { $population->addTour($tour); } diff --git a/Math/Optimization/TSP/GA.php b/Math/Optimization/TSP/GA.php index e225df767..1a15400c0 100644 --- a/Math/Optimization/TSP/GA.php +++ b/Math/Optimization/TSP/GA.php @@ -89,20 +89,20 @@ class GA $shift = self::ELITISM ? 1 : 0; $newPopulation = new Population($this->cityPool, $count = $population->count(), false); - $newPopulation->addTour($population->getFittest()); + $newPopulation->add($population->getFittest()); for ($i = $shift; $i < $count; $i++) { $parent1 = $this->tournamentSelection($population); $parent2 = $this->tournamentSelection($population); $child = $this->crossover($parent1, $parent2); - $newPopulation->setTour($i, $child); + $newPopulation->set($i, $child); } $count = $newPopulation->count(); for ($i = $shift; $i < $count; $i++) { - $this->mutate($newPopulation->getTour($i)); + $this->mutate($newPopulation->get($i)); } return $newPopulation; @@ -197,7 +197,7 @@ class GA $populationSize = $population->count(); for ($i = 0; $i < self::TOURNAMENT; $i++) { - $tournament->addTour($population->getTour(mt_rand(0, $populationSize))); + $tournament->add($population->get(mt_rand(0, $populationSize))); } return $tournament->getFittest(); diff --git a/Math/Optimization/TSP/Population.php b/Math/Optimization/TSP/Population.php index a7b1eeb1c..9d8024ed3 100644 --- a/Math/Optimization/TSP/Population.php +++ b/Math/Optimization/TSP/Population.php @@ -65,7 +65,7 @@ class Population implements \Countable * @since 1.0.0 * @author Dennis Eichhorn */ - public function insertTourAt(int $index, Tour $tour) + public function insertAt(int $index, Tour $tour) { $this->tours = array_slice($this->tours, 0, $index) + [$tour] + array_slice($this->tours, $index); } @@ -79,7 +79,7 @@ class Population implements \Countable * @since 1.0.0 * @author Dennis Eichhorn */ - public function setTour(int $index, Tour $tour) + public function set(int $index, Tour $tour) { $this->tours[$index] = $tour; asort($this->tours); @@ -93,7 +93,7 @@ class Population implements \Countable * @since 1.0.0 * @author Dennis Eichhorn */ - public function addTour(Tour $tour) + public function add(Tour $tour) { $this->tours[] = $tour; } @@ -108,7 +108,7 @@ class Population implements \Countable * @since 1.0.0 * @author Dennis Eichhorn */ - public function getTour(int $index) + public function get(int $index) { return $this->tours[$index] ?? null; } diff --git a/Math/Shape/D2/Circle.php b/Math/Shape/D2/Circle.php index 259d37d70..ab190e1cd 100644 --- a/Math/Shape/D2/Circle.php +++ b/Math/Shape/D2/Circle.php @@ -13,7 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Math\Algebra; +namespace phpOMS\Math\Shape\D2; /** * Circle shape. @@ -26,7 +26,7 @@ namespace phpOMS\Math\Algebra; * @link http://orange-management.com * @since 1.0.0 */ -class Circle +class Circle implements D2ShapeInterface { /** @@ -39,7 +39,7 @@ class Circle * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getArea(float $r) + public static function getSurface(float $r) { return pi() * $r ** 2; } @@ -54,7 +54,7 @@ class Circle * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getCircumference(float $r) + public static function getPerimeter(float $r) { return 2 * pi() * $r; } @@ -62,16 +62,16 @@ class Circle /** * Radius * - * @param float $area Area + * @param float $surface Surface * * @return float * * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getRadiusByArea(float $area) + public static function getRadiusBySurface(float $surface) { - return sqrt($area / pi()); + return sqrt($surface / pi()); } /** @@ -84,7 +84,7 @@ class Circle * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getRadiusByCircumference(float $C) + public static function getRadiusByPerimeter(float $C) { return $C / (2 * pi()); } diff --git a/Math/Shape/D2/D2ShapeInterface.php b/Math/Shape/D2/D2ShapeInterface.php new file mode 100644 index 000000000..538c6ba1a --- /dev/null +++ b/Math/Shape/D2/D2ShapeInterface.php @@ -0,0 +1,34 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Math\Shape\D2; + +use phpOMS\Math\Shape\ShapeInterface; + +/** + * Shape interface. + * + * @category Framework + * @package phpOMS\Math + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +interface D2ShapeInterface extends ShapeInterface +{ + public static function getPerimeter() : float; +} diff --git a/Math/Shape/D2/Ellipse.php b/Math/Shape/D2/Ellipse.php index b8153ce28..e7583011d 100644 --- a/Math/Shape/D2/Ellipse.php +++ b/Math/Shape/D2/Ellipse.php @@ -13,7 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Math\Algebra; +namespace phpOMS\Math\Shape\D2; /** * Ellipse shape. @@ -26,7 +26,7 @@ namespace phpOMS\Math\Algebra; * @link http://orange-management.com * @since 1.0.0 */ -class Ellipse +class Ellipse implements D2ShapeInterface { /** @@ -45,7 +45,7 @@ class Ellipse * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getArea(float $a, float $b) + public static function getSurface(float $a, float $b) { return pi() * $a * $b; } @@ -66,7 +66,7 @@ class Ellipse * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getCircumference(float $a, float $b) + public static function getPerimeter(float $a, float $b) { return pi() * ($a + $b) * (3 * ($a - $b) ** 2 / (($a + $b) ** 2 * (sqrt(-3 * ($a - $b) ** 2 / (($a + $b) ** 2) + 4) + 10)) + 1); } diff --git a/Math/Shape/D2/Polygon.php b/Math/Shape/D2/Polygon.php index 39505cae3..83291a4b3 100644 --- a/Math/Shape/D2/Polygon.php +++ b/Math/Shape/D2/Polygon.php @@ -14,8 +14,6 @@ * @link http://orange-management.com */ namespace phpOMS\Math\Shape\D2; -use phpOMS\Math\Shape\ShapeInterface; - /** * Polygon class. @@ -28,7 +26,7 @@ use phpOMS\Math\Shape\ShapeInterface; * @link http://orange-management.com * @since 1.0.0 */ -class Polygon implements ShapeInterface +class Polygon implements D2ShapeInterface { /** @@ -283,4 +281,82 @@ class Polygon implements ShapeInterface return $this->barycenter; } + + /** + * Point polygon relative position + * + * @param array $point Point location + * + * @return int + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public static function pointInPolygon(array $point) : int + { + $length = count($this->coord); + + // Polygon has to start and end with same point + if ($this->coord[0]['x'] !== $this->coord[$length - 1]['x'] || $this->coord[0]['y'] !== $this->coord[$length - 1]['y']) { + $this->coord[] = $this->coord[0]; + } + + // On vertex? + if (self::isOnVertex($point, $this->coord)) { + return 0; + } + + // Inside or ontop? + $countIntersect = 0; + $this->coord_count = count($this->coord); + + // todo: return based on highest possibility not by first match + for ($i = 1; $i < $this->coord_count; $i++) { + $vertex1 = $this->coord[$i - 1]; + $vertex2 = $this->coord[$i]; + + if (abs($vertex1['y'] - $vertex2['y']) < self::EPSILON && abs($vertex1['y'] - $point['y']) < self::EPSILON && $point['x'] > min($vertex1['x'], $vertex2['x']) && $point['x'] < max($vertex1['x'], $vertex2['x'])) { + return 0; // boundary + } + + if ($point['y'] > min($vertex1['y'], $vertex2['y']) && $point['y'] <= max($vertex1['y'], $vertex2['y']) && $point['x'] <= max($vertex1['x'], $vertex2['x']) && abs($vertex1['y'] - $vertex2['y']) >= self::EPSILON) { + $xinters = ($point['y'] - $vertex1['y']) * ($vertex2['x'] - $vertex1['x']) / ($vertex2['y'] - $vertex1['y']) + $vertex1['x']; + + if (abs($xinters - $point['x']) < self::EPSILON) { + return 0; // boundary + } + + if (abs($vertex1['x'] - $vertex2['x']) < self::EPSILON || $point['x'] < $xinters) { + $countIntersect++; + } + } + } + + if ($countIntersect % 2 != 0) { + return -1; + } + + return 1; + } + + /** + * Is point on vertex? + * + * @param array $point Point location + * + * @return bool + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + private static function isOnVertex(array $point) : bool + { + foreach ($this->coord as $vertex) { + if (abs($point['x'] - $vertex['x']) < self::EPSILON && abs($point['y'] - $vertex['y']) < self::EPSILON) { + return true; + } + } + + return false; + } } diff --git a/Math/Shape/D2/Rectangle.php b/Math/Shape/D2/Rectangle.php index 755714e90..ba28302e6 100644 --- a/Math/Shape/D2/Rectangle.php +++ b/Math/Shape/D2/Rectangle.php @@ -13,7 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Math\Algebra; +namespace phpOMS\Math\Shape\D2; /** * Rectangle shape. @@ -26,7 +26,7 @@ namespace phpOMS\Math\Algebra; * @link http://orange-management.com * @since 1.0.0 */ -class Rectangle +class Rectangle implements D2ShapeInterface { /** @@ -40,7 +40,7 @@ class Rectangle * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getArea(float $a, float $b) + public static function getSurface(float $a, float $b) { return $a * $b; } diff --git a/Math/Shape/D2/Trapezoid.php b/Math/Shape/D2/Trapezoid.php index 66d96a2c3..569e6a3f8 100644 --- a/Math/Shape/D2/Trapezoid.php +++ b/Math/Shape/D2/Trapezoid.php @@ -13,7 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Math\Algebra; +namespace phpOMS\Math\Shape\D2; /** * Trapezoid shape. @@ -26,7 +26,7 @@ namespace phpOMS\Math\Algebra; * @link http://orange-management.com * @since 1.0.0 */ -class Trapezoid +class Trapezoid implements D2ShapeInterface { /** @@ -47,7 +47,7 @@ class Trapezoid * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getArea(float $a, float $b, float $h) + public static function getSurface(float $a, float $b, float $h) { return ($a + $b) / 2 * $h; } diff --git a/Math/Shape/D2/Triangle.php b/Math/Shape/D2/Triangle.php index 66ea404c1..07e1d2fd2 100644 --- a/Math/Shape/D2/Triangle.php +++ b/Math/Shape/D2/Triangle.php @@ -13,7 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Math\Algebra; +namespace phpOMS\Math\Shape\D2; /** * Triangle shape. @@ -26,7 +26,7 @@ namespace phpOMS\Math\Algebra; * @link http://orange-management.com * @since 1.0.0 */ -class Triangle +class Triangle implements D2ShapeInterface { /** @@ -46,7 +46,7 @@ class Triangle * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getArea(float $b, float $h) + public static function getSurface(float $b, float $h) { return $h * $b / 2; } diff --git a/Math/Shape/D3/Cone.php b/Math/Shape/D3/Cone.php index 20e66952a..3b4efdce6 100644 --- a/Math/Shape/D3/Cone.php +++ b/Math/Shape/D3/Cone.php @@ -13,7 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Math\Algebra; +namespace phpOMS\Math\Shape\D3; /** * Cone shape. @@ -26,7 +26,7 @@ namespace phpOMS\Math\Algebra; * @link http://orange-management.com * @since 1.0.0 */ -class Cone +class Cone implements D3ShapeInterface { /** diff --git a/Math/Shape/D3/Cuboid.php b/Math/Shape/D3/Cuboid.php index 62330bfea..39468e1c6 100644 --- a/Math/Shape/D3/Cuboid.php +++ b/Math/Shape/D3/Cuboid.php @@ -13,7 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Math\Algebra; +namespace phpOMS\Math\Shape\D3; /** * Cuboid shape. @@ -26,7 +26,7 @@ namespace phpOMS\Math\Algebra; * @link http://orange-management.com * @since 1.0.0 */ -class Cuboid +class Cuboid implements D3ShapeInterface { /** diff --git a/Math/Shape/D3/Cylinder.php b/Math/Shape/D3/Cylinder.php index eccf0571c..a4d49f1cb 100644 --- a/Math/Shape/D3/Cylinder.php +++ b/Math/Shape/D3/Cylinder.php @@ -13,7 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Math\Algebra; +namespace phpOMS\Math\Shape\D3; /** * Cylinder shape. @@ -26,7 +26,7 @@ namespace phpOMS\Math\Algebra; * @link http://orange-management.com * @since 1.0.0 */ -class Cylinder +class Cylinder implements D3ShapeInterface { /** diff --git a/Math/Shape/D3/D3ShapeInterface.php b/Math/Shape/D3/D3ShapeInterface.php new file mode 100644 index 000000000..7e9a86058 --- /dev/null +++ b/Math/Shape/D3/D3ShapeInterface.php @@ -0,0 +1,34 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Math\Shape\D3; + +use phpOMS\Math\Shape\ShapeInterface; + +/** + * Shape interface. + * + * @category Framework + * @package phpOMS\Math + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +interface D2ShapeInterface extends ShapeInterface +{ + public static function getVolume() : float; +} diff --git a/Math/Shape/D3/RectangularPyramid.php b/Math/Shape/D3/RectangularPyramid.php index 695d0ccb6..cdbf6bbac 100644 --- a/Math/Shape/D3/RectangularPyramid.php +++ b/Math/Shape/D3/RectangularPyramid.php @@ -13,7 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Math\Algebra; +namespace phpOMS\Math\Shape\D3; /** * Rectangular pyramid shape. @@ -26,7 +26,7 @@ namespace phpOMS\Math\Algebra; * @link http://orange-management.com * @since 1.0.0 */ -class RectangularPyramid +class RectangularPyramid implements D3ShapeInterface { /** diff --git a/Math/Shape/D3/Sphere.php b/Math/Shape/D3/Sphere.php index 16260d77e..99cb7503f 100644 --- a/Math/Shape/D3/Sphere.php +++ b/Math/Shape/D3/Sphere.php @@ -26,7 +26,7 @@ namespace phpOMS\Math\Shape\D3; * @link http://orange-management.com * @since 1.0.0 */ -class Sphere +class Sphere implements D3ShapeInterface { /** @@ -73,7 +73,7 @@ class Sphere * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getVolume(float $r) + public static function getVolumeByRadius(float $r) { return 4 / 3 * pi() * $r ** 3; } @@ -103,7 +103,7 @@ class Sphere * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getSurface(float $r) + public static function getSurfaceByRadius(float $r) { return 4 * pi() * $r ** 2; } @@ -122,4 +122,35 @@ class Sphere { return sqrt($S / (4 * pi())); } + + public static function byRadius(float $r) : Sphere + { + return new self($r); + } + + public static function byVolume(float $v) : Sphere + { + return new self(self::getRadiusByVolume($v)); + } + + public static function bySurface(float $s) : Sphere + { + return new self(self::getRadiusBySurface($s)); + } + + public function __construct(float $radius) { + $this->radius = $radius; + } + + public function getVolume() : float { + return self::getVolumeByRadius($this->radius); + } + + public function getRadius() : float { + return $this->radius; + } + + public function getSurface() : float { + return self::getSurfaceByRadius($this->radius); + } } diff --git a/Math/Shape/D3/Tetrahedron.php b/Math/Shape/D3/Tetrahedron.php index b69800d2a..b4dff1cb6 100644 --- a/Math/Shape/D3/Tetrahedron.php +++ b/Math/Shape/D3/Tetrahedron.php @@ -13,7 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Math\Algebra; +namespace phpOMS\Math\Shape\D3; /** * Tetraedron shape. @@ -26,7 +26,7 @@ namespace phpOMS\Math\Algebra; * @link http://orange-management.com * @since 1.0.0 */ -class Tetrahedron +class Tetrahedron implements D3ShapeInterface { /** diff --git a/Math/Shape/ShapeInterface.php b/Math/Shape/ShapeInterface.php index bc957edb1..57acd4ccc 100644 --- a/Math/Shape/ShapeInterface.php +++ b/Math/Shape/ShapeInterface.php @@ -28,4 +28,5 @@ namespace phpOMS\Math\Shape; */ interface ShapeInterface { + public static function getSurface() : float; }