|
1
|
|
|
<?php |
|
2
|
|
|
/** @formatter:off |
|
3
|
|
|
* ****************************************************************** |
|
4
|
|
|
* Created by Marko Kungla on Jun 27, 2016 - 4:29:53 AM |
|
5
|
|
|
* Contact [email protected] |
|
6
|
|
|
* @copyright 2016 Marko Kungla - https://github.com/mkungla |
|
7
|
|
|
* @license The MIT License (MIT) |
|
8
|
|
|
* |
|
9
|
|
|
* @category AframeVR |
|
10
|
|
|
* @package aframe-php |
|
11
|
|
|
* |
|
12
|
|
|
* Lang PHP (php version >= 7) |
|
13
|
|
|
* Encoding UTF-8 |
|
14
|
|
|
* File CylinderMethods.php |
|
15
|
|
|
* Code format PSR-2 and 12 |
|
16
|
|
|
* @link https://github.com/mkungla/aframe-php |
|
17
|
|
|
* @issues https://github.com/mkungla/aframe-php/issues |
|
18
|
|
|
* ******************************************************************** |
|
19
|
|
|
* Contributors: |
|
20
|
|
|
* @author Marko Kungla <[email protected]> |
|
21
|
|
|
* ******************************************************************** |
|
22
|
|
|
* Comments: |
|
23
|
|
|
* @formatter:on */ |
|
24
|
|
|
namespace AframeVR\Core\Components\Geometry\Methods; |
|
25
|
|
|
|
|
26
|
|
|
class CylinderMethods |
|
27
|
|
|
{ |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Height of the cylinder. |
|
31
|
|
|
* |
|
32
|
|
|
* @param array $dom_attributes |
|
33
|
|
|
* @param double $height |
|
34
|
|
|
* @return void |
|
35
|
|
|
*/ |
|
36
|
6 |
|
public function height(array &$dom_attributes, float $height) |
|
37
|
|
|
{ |
|
38
|
6 |
|
$dom_attributes['height'] = $height; |
|
39
|
6 |
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Whether the ends of the cylinder are open (true) or capped (false). |
|
43
|
|
|
* |
|
44
|
|
|
* @param array $dom_attributes |
|
45
|
|
|
* @param bool|false $openEnded |
|
46
|
|
|
* @return void |
|
47
|
|
|
*/ |
|
48
|
6 |
|
public function openEnded(array &$dom_attributes, bool $openEnded = false) |
|
49
|
|
|
{ |
|
50
|
6 |
|
$dom_attributes['openEnded'] = $openEnded ? 'true' : 'false'; |
|
51
|
6 |
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Radius of the cylinder. |
|
55
|
|
|
* |
|
56
|
|
|
* @param array $dom_attributes |
|
57
|
|
|
* @param double $radius |
|
58
|
|
|
* @return void |
|
59
|
|
|
*/ |
|
60
|
6 |
|
public function radius(array &$dom_attributes, float $radius) |
|
61
|
|
|
{ |
|
62
|
6 |
|
$dom_attributes['radius'] = $radius; |
|
63
|
6 |
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Number of rows of faces along the height of the cylinder. |
|
67
|
|
|
* |
|
68
|
|
|
* @param array $dom_attributes |
|
69
|
|
|
* @param int $segmentsHeight |
|
70
|
|
|
* @return void |
|
71
|
|
|
*/ |
|
72
|
5 |
|
public function segmentsHeight(array &$dom_attributes, int $segmentsHeight) |
|
73
|
|
|
{ |
|
74
|
5 |
|
$dom_attributes['segmentsHeight'] = $segmentsHeight; |
|
75
|
5 |
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Central angle in degrees. |
|
79
|
|
|
* |
|
80
|
|
|
* @param array $dom_attributes |
|
81
|
|
|
* @param double $thetaLength |
|
82
|
|
|
* @return void |
|
83
|
|
|
*/ |
|
84
|
6 |
|
public function thetaLength(array &$dom_attributes, float $thetaLength) |
|
85
|
|
|
{ |
|
86
|
6 |
|
$dom_attributes['thetaLength'] = $thetaLength; |
|
87
|
6 |
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Starting angle in degrees. |
|
91
|
|
|
* |
|
92
|
|
|
* @param array $dom_attributes |
|
93
|
|
|
* @param double $thetaStart |
|
94
|
|
|
* @return void |
|
95
|
|
|
*/ |
|
96
|
6 |
|
public function thetaStart(array &$dom_attributes, float $thetaStart) |
|
97
|
|
|
{ |
|
98
|
6 |
|
$dom_attributes['thetaStart'] = $thetaStart; |
|
99
|
6 |
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* Number of segmented faces around the circumference of the cylinder. |
|
103
|
|
|
* |
|
104
|
|
|
* @param array $dom_attributes |
|
105
|
|
|
* @param int $segmentsRadial |
|
106
|
|
|
* @return void |
|
107
|
|
|
*/ |
|
108
|
6 |
|
public function segmentsRadial(array &$dom_attributes, int $segmentsRadial) |
|
109
|
|
|
{ |
|
110
|
6 |
|
$dom_attributes['segmentsRadial'] = $segmentsRadial; |
|
111
|
6 |
|
} |
|
112
|
|
|
} |
|
113
|
|
|
|