| 1 | <?php |
||
| 7 | class Vector2 extends Vector |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Initializes a new instance of this class. |
||
| 11 | * |
||
| 12 | * @param float $x The X-component to set. |
||
| 13 | * @param float $y The Y-component to set. |
||
| 14 | */ |
||
| 15 | 10 | public function __construct($x, $y) |
|
| 22 | |||
| 23 | /** |
||
| 24 | * Gets the X-component from this vector. |
||
| 25 | * |
||
| 26 | * @return float |
||
| 27 | */ |
||
| 28 | 3 | public function getX() |
|
| 32 | |||
| 33 | /** |
||
| 34 | * Sets the X-component in this vector. |
||
| 35 | * |
||
| 36 | * @param float $x The X-component to set |
||
| 37 | */ |
||
| 38 | 10 | public function setX($x) |
|
| 42 | |||
| 43 | /** |
||
| 44 | * Gets the Y-component from this vector. |
||
| 45 | * |
||
| 46 | * @return float |
||
| 47 | */ |
||
| 48 | 3 | public function getY() |
|
| 52 | |||
| 53 | /** |
||
| 54 | * Sets the Y-component in this vector. |
||
| 55 | * |
||
| 56 | * @param float $y The Y-component to set |
||
| 57 | */ |
||
| 58 | 10 | public function setY($y) |
|
| 62 | |||
| 63 | /** |
||
| 64 | * Validates the index. |
||
| 65 | * |
||
| 66 | * @param int $index The index to validate. |
||
| 67 | * @param bool $indexShouldExists Whether or not the index should exists. |
||
| 68 | * @throws InvalidArgumentException Thrown when the index is invalid. |
||
| 69 | */ |
||
| 70 | 5 | protected function validateIndex($index, $indexShouldExists) |
|
| 76 | } |
||
| 77 |