Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
box.php
1<?
3
8class Box
9{
11 protected $vMin = array(0, 0, 0);
13 protected $vMax = array(0, 0, 0);
14
19 public function __construct(array $sizes)
20 {
21 $this->vMax = $sizes;
22 }
23
27 public function getVMin()
28 {
29 return $this->vMin;
30 }
31
32 public function getSizes()
33 {
34 return array(
35 $this->vMax[0] - $this->vMin[0],
36 $this->vMax[1] - $this->vMin[1],
37 $this->vMax[2] - $this->vMin[2]
38 );
39 }
40
44 public function getVMax()
45 {
46 return $this->vMax;
47 }
48
52 public function getVertexes()
53 {
54 return array($this->vMin, $this->vMax);
55 }
56
60 public function setVMin(array $vertex)
61 {
62 $this->vMin = $vertex;
63 }
64
68 public function setVMax(array $vertex)
69 {
70 $this->vMax = $vertex;
71 }
72
77 public function move(array $point)
78 {
79 for($i = 0; $i < 3; $i++)
80 {
81 $this->vMax[$i] = $this->vMax[$i] - $this->vMin[$i] + $point[$i];
82 $this->vMin[$i] = $point[$i];
83 }
84 }
85
90 public function rotate(array $axes) // array (0,1,0)
91 {
92 if($axes[0])
93 {
94 $this->vMin = array($this->vMin[0], $this->vMin[2], $this->vMin[1]);
95 $this->vMax = array($this->vMax[0], $this->vMax[2], $this->vMax[1]);
96 }
97
98 if($axes[1])
99 {
100 $this->vMin = array($this->vMin[2], $this->vMin[1], $this->vMin[0]);
101 $this->vMax = array($this->vMax[2], $this->vMax[1], $this->vMax[0]);
102 }
103
104 if($axes[2])
105 {
106 $this->vMin = array($this->vMin[2], $this->vMin[0], $this->vMin[1]);
107 $this->vMax = array($this->vMax[2], $this->vMax[0], $this->vMax[1]);
108 }
109 }
110}
__construct(array $sizes)
Definition box.php:19