|
1
|
|
|
<?php |
|
2
|
|
|
/** @formatter:off |
|
3
|
|
|
* ****************************************************************** |
|
4
|
|
|
* Created by Marko Kungla on Jun 27, 2016 - 5:30:36 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 ConeMethods.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 ConeMethods |
|
27
|
|
|
{ |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* The cone primitive under the hood is a cylinder primitive with varying top and bottom radiuses. |
|
31
|
|
|
*/ |
|
32
|
|
|
const DEFAULTS = array( |
|
33
|
|
|
/* Height of the cone. */ |
|
34
|
|
|
'height' => 2, |
|
35
|
|
|
/* Whether the ends of the cone are open (true) or capped ('false'). */ |
|
36
|
|
|
'openEnded' => 'false', |
|
37
|
|
|
/* Radius of the bottom end of the cone. */ |
|
38
|
|
|
'radiusBottom' => 1, |
|
39
|
|
|
/* Radius of the top end of the cone. */ |
|
40
|
|
|
'radiusTop' => 1, |
|
41
|
|
|
/* Number of segmented faces around the circumference of the cone. */ |
|
42
|
|
|
'segmentsRadial' => 36, |
|
43
|
|
|
/* Number of rows of faces along the height of the cone. */ |
|
44
|
|
|
'segmentsHeight' => 18, |
|
45
|
|
|
/* Starting angle in degrees. */ |
|
46
|
|
|
'thetaStart' => 0, |
|
47
|
|
|
/* Central angle in degrees. */ |
|
48
|
|
|
'thetaLength' => 360 |
|
49
|
|
|
); |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Height of the cone. |
|
53
|
|
|
* |
|
54
|
|
|
* @param &array $dom_attributes |
|
|
|
|
|
|
55
|
|
|
* @param float|int $height |
|
|
|
|
|
|
56
|
|
|
* @return void |
|
57
|
|
|
*/ |
|
58
|
1 |
|
public function height(array &$dom_attributes, float $height) |
|
59
|
|
|
{ |
|
60
|
1 |
|
$dom_attributes['height'] = $height; |
|
61
|
1 |
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Whether the ends of the cone are open (true) or capped (false). |
|
65
|
|
|
* |
|
66
|
|
|
* @param &array $dom_attributes |
|
|
|
|
|
|
67
|
|
|
* @param bool|false $openEnded |
|
68
|
|
|
* @return void |
|
69
|
|
|
*/ |
|
70
|
1 |
|
public function openEnded(array &$dom_attributes, bool $openEnded = false) |
|
71
|
|
|
{ |
|
72
|
1 |
|
$dom_attributes['openEnded'] = $openEnded ? 'true' : 'false'; |
|
73
|
|
|
; |
|
74
|
1 |
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Radius of the bottom end of the cone. |
|
78
|
|
|
* |
|
79
|
|
|
* @param &array $dom_attributes |
|
|
|
|
|
|
80
|
|
|
* @param float|int $radiusBottom |
|
|
|
|
|
|
81
|
|
|
* @return void |
|
82
|
|
|
*/ |
|
83
|
1 |
|
public function radiusBottom(array &$dom_attributes, float $radiusBottom) |
|
84
|
|
|
{ |
|
85
|
1 |
|
$dom_attributes['radiusBottom'] = $radiusBottom; |
|
86
|
1 |
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Radius of the top end of the cone. |
|
90
|
|
|
* |
|
91
|
|
|
* @param &array $dom_attributes |
|
|
|
|
|
|
92
|
|
|
* @param float|int $radiusBottom |
|
|
|
|
|
|
93
|
|
|
* @return void |
|
94
|
|
|
*/ |
|
95
|
1 |
|
public function radiusTop(array &$dom_attributes, float $radiusTop) |
|
96
|
|
|
{ |
|
97
|
1 |
|
$dom_attributes['radiusTop'] = $radiusTop; |
|
98
|
1 |
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* Number of segmented faces around the circumference of the cone. |
|
102
|
|
|
* |
|
103
|
|
|
* @param &array $dom_attributes |
|
|
|
|
|
|
104
|
|
|
* @param int $segmentsRadial |
|
105
|
|
|
* @return void |
|
106
|
|
|
*/ |
|
107
|
1 |
|
public function segmentsRadial(array &$dom_attributes, int $segmentsRadial) |
|
108
|
|
|
{ |
|
109
|
1 |
|
$dom_attributes['segmentsRadial'] = $segmentsRadial; |
|
110
|
1 |
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Number of rows of faces along the height of the cone. |
|
114
|
|
|
* |
|
115
|
|
|
* @param &array $dom_attributes |
|
|
|
|
|
|
116
|
|
|
* @param int $segmentsHeight |
|
117
|
|
|
* @return void |
|
118
|
|
|
*/ |
|
119
|
1 |
|
public function segmentsHeight(array &$dom_attributes, int $segmentsHeight) |
|
120
|
|
|
{ |
|
121
|
1 |
|
$dom_attributes['segmentsHeight'] = $segmentsHeight; |
|
122
|
1 |
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* Starting angle in degrees. |
|
126
|
|
|
* |
|
127
|
|
|
* @param &array $dom_attributes |
|
|
|
|
|
|
128
|
|
|
* @param float|int $thetaStart |
|
|
|
|
|
|
129
|
|
|
* @return void |
|
130
|
|
|
*/ |
|
131
|
1 |
|
public function thetaStart(array &$dom_attributes, float $thetaStart) |
|
132
|
|
|
{ |
|
133
|
1 |
|
$dom_attributes['thetaStart'] = $thetaStart; |
|
134
|
1 |
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* Central angle in degrees. |
|
138
|
|
|
* |
|
139
|
|
|
* @param &array $dom_attributes |
|
|
|
|
|
|
140
|
|
|
* @param float|int $thetaLength |
|
|
|
|
|
|
141
|
|
|
* @return void |
|
142
|
|
|
*/ |
|
143
|
1 |
|
public function thetaLength(array &$dom_attributes, float $thetaLength) |
|
144
|
|
|
{ |
|
145
|
1 |
|
$dom_attributes['thetaLength'] = $thetaLength; |
|
146
|
1 |
|
} |
|
147
|
|
|
} |
|
148
|
|
|
|
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.