Регистр файлов

This commit is contained in:
origami11 2017-02-16 10:14:36 +03:00
parent 4fd0187ea6
commit c8958cbee0
83 changed files with 25 additions and 53 deletions

View file

@ -1,51 +0,0 @@
<?php
require_once "core/geometry/point.php";
class Rectangle
{
public $left, $top, $width, $height;
function __construct($left = 0, $top = 0, $width = 0, $height = 0)
{
$this->left = $left;
$this->top = $top;
$this->width = $width;
$this->height = $height;
}
function __get($name)
{
switch ($name) {
case 'right': return $this->left + $this->width;
case 'bottom': return $this->top + $this->height;
}
}
function __set($name, $value)
{
switch ($name) {
case 'right': $this->width = $value - $this->left;
case 'bottom': $this->height = $value - $this->top;
}
}
/**
* Смещает прямоугольник на заданное положение
*/
function addPoint(Point $point)
{
$result = clone $this;
$result->left += $point->left;
$result->top += $point->top;
return $result;
}
/**
* Координаты точки при выравнивании прямоугольника относительно текущего
*/
function alignment(Rectangle $base)
{
return new Point((($base->left + $base->right) - ($this->left + $this->right)) / 2, $base->bottom - $this->height);
}
}