1
|
|
|
<?php |
2
|
|
|
/** @formatter:off |
3
|
|
|
* ****************************************************************** |
4
|
|
|
* Created by Marko Kungla on Jun 27, 2016 - 5:45:05 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 RingMethods.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 RingMethods |
27
|
|
|
{ |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* The ring geometry defines a flat ring, like a CD. |
31
|
|
|
* Note that because it is flat, |
32
|
|
|
* only a single side of the ring will be rendered if side: double is not specified on the material component. |
33
|
|
|
*/ |
34
|
|
|
const DEFAULTS = array( |
35
|
|
|
/* Radius of the inner hole of the ring. */ |
36
|
|
|
'radiusInner' => 1, |
37
|
|
|
/* Radius of the outer edge of the ring. */ |
38
|
|
|
'radiusOuter' => 1, |
39
|
|
|
/* Number of segments. A higher number means the ring will be more round */ |
40
|
|
|
'segmentsTheta' => 32, |
41
|
|
|
/* Number of triangles within each face defined by segmentsTheta. */ |
42
|
|
|
'segmentsPhi' => 8, |
43
|
|
|
/* Starting angle in degrees. */ |
44
|
|
|
'thetaStart' => 0, |
45
|
|
|
/* Central angle in degrees. */ |
46
|
|
|
'thetaLength' => 360 |
47
|
|
|
); |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Radius of the inner hole of the ring. |
51
|
|
|
* |
52
|
|
|
* @param &array $dom_attributes |
|
|
|
|
53
|
|
|
* @param float|int $radiusInner |
|
|
|
|
54
|
|
|
* @return void |
55
|
|
|
*/ |
56
|
1 |
|
public function radiusInner(array &$dom_attributes, float $radiusInner) |
57
|
|
|
{ |
58
|
1 |
|
$dom_attributes['radiusInner'] = $radiusInner; |
59
|
1 |
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Radius of the outer edge of the ring. |
63
|
|
|
* |
64
|
|
|
* @param &array $dom_attributes |
|
|
|
|
65
|
|
|
* @param float|int $radiusOuter |
|
|
|
|
66
|
|
|
* @return void |
67
|
|
|
*/ |
68
|
1 |
|
public function radiusOuter(array &$dom_attributes, float $radiusOuter) |
69
|
|
|
{ |
70
|
1 |
|
$dom_attributes['radiusOuter'] = $radiusOuter; |
71
|
1 |
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Central angle in degrees. |
75
|
|
|
* |
76
|
|
|
* @param &array $dom_attributes |
|
|
|
|
77
|
|
|
* @param float|int $thetaLength |
|
|
|
|
78
|
|
|
* @return void |
79
|
|
|
*/ |
80
|
1 |
|
public function thetaLength(array &$dom_attributes, float $thetaLength) |
81
|
|
|
{ |
82
|
1 |
|
$dom_attributes['thetaLength'] = $thetaLength; |
83
|
1 |
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Starting angle in degrees. |
87
|
|
|
* |
88
|
|
|
* @param &array $dom_attributess |
|
|
|
|
89
|
|
|
* @param float|int $thetaStart |
|
|
|
|
90
|
|
|
* @return void |
91
|
|
|
*/ |
92
|
1 |
|
public function thetaStart(array &$dom_attributes, float $thetaStart) |
93
|
|
|
{ |
94
|
1 |
|
$dom_attributes['thetaStart'] = $thetaStart; |
95
|
1 |
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Number of segments. |
99
|
|
|
* A higher number means the ring will be more round. |
100
|
|
|
* |
101
|
|
|
* @param &array $dom_attributes |
|
|
|
|
102
|
|
|
* @param int $segmentsTheta |
103
|
|
|
* @return void |
104
|
|
|
*/ |
105
|
1 |
|
public function segmentsTheta(array &$dom_attributes, int $segmentsTheta) |
106
|
|
|
{ |
107
|
1 |
|
$dom_attributes['segmentsTheta'] = $segmentsTheta; |
108
|
1 |
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Number of triangles within each face defined by segmentsTheta. |
112
|
|
|
* |
113
|
|
|
* @param &array $dom_attributes |
|
|
|
|
114
|
|
|
* @param int $segmentsPhi |
115
|
|
|
* @return void |
116
|
|
|
*/ |
117
|
1 |
|
public function segmentsPhi(array &$dom_attributes, int $segmentsPhi) |
118
|
|
|
{ |
119
|
1 |
|
$dom_attributes['segmentsPhi'] = $segmentsPhi; |
120
|
1 |
|
} |
121
|
|
|
} |
122
|
|
|
|
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.