1
|
|
|
<?php |
2
|
|
|
/** @formatter:off |
3
|
|
|
* ****************************************************************** |
4
|
|
|
* Created by Marko Kungla on Jun 27, 2016 - 5:59:08 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 TorusMethods.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 TorusMethods |
27
|
|
|
{ |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* The torus primitive defines a donut shape. |
31
|
|
|
*/ |
32
|
|
|
const DEFAULTS = array( |
33
|
|
|
/* Radius of the outer edge of the torus. */ |
34
|
|
|
'radius' => 1, |
35
|
|
|
/* Radius of the tube. */ |
36
|
|
|
'radiusTubular' => 0.2, |
37
|
|
|
/* Number of segments along the circumference of the tube ends. A higher number means the tube will be more round. */ |
38
|
|
|
'segmentsRadial' => 36, |
39
|
|
|
/* Number of segments along the circumference of the tube face. A higher number means the tube will be more round. */ |
40
|
|
|
'segmentsTubular' => 32, |
41
|
|
|
/* Central angle. */ |
42
|
|
|
'arc' => 360 |
43
|
|
|
); |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Radius of the outer edge of the torus. |
47
|
|
|
* |
48
|
|
|
* @param &array $dom_attributes |
|
|
|
|
49
|
|
|
* @param float|int $radius |
|
|
|
|
50
|
|
|
* @return void |
51
|
|
|
*/ |
52
|
1 |
|
public function radius(array &$dom_attributes, float $radius) |
53
|
|
|
{ |
54
|
1 |
|
$dom_attributes['radius'] = $radius; |
55
|
1 |
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Radius of the tube. |
59
|
|
|
* |
60
|
|
|
* @param &array $dom_attributes |
|
|
|
|
61
|
|
|
* @param float|int $radiusTubular |
|
|
|
|
62
|
|
|
* @return void |
63
|
|
|
*/ |
64
|
1 |
|
public function radiusTubular(array &$dom_attributes, float $radiusTubular) |
65
|
|
|
{ |
66
|
1 |
|
$dom_attributes['radiusTubular'] = $radiusTubular; |
67
|
1 |
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Number of segments along the circumference of the tube ends. |
71
|
|
|
* A higher number means the tube will be more round. |
72
|
|
|
* |
73
|
|
|
* @param &array $dom_attributes |
|
|
|
|
74
|
|
|
* @param int $segmentsRadial |
75
|
|
|
* @return void |
76
|
|
|
*/ |
77
|
1 |
|
public function segmentsRadial(array &$dom_attributes, int $segmentsRadial) |
78
|
|
|
{ |
79
|
1 |
|
$dom_attributes['segmentsRadial'] = $segmentsRadial; |
80
|
1 |
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Number of segments along the circumference of the tube face. |
84
|
|
|
* A higher number means the tube will be more round. |
85
|
|
|
* |
86
|
|
|
* @param &array $dom_attributes |
|
|
|
|
87
|
|
|
* @param int $segmentsTubular |
88
|
|
|
* @return void |
89
|
|
|
*/ |
90
|
1 |
|
public function segmentsTubular(array &$dom_attributes, int $segmentsTubular) |
91
|
|
|
{ |
92
|
1 |
|
$dom_attributes['segmentsTubular'] = $segmentsTubular; |
93
|
1 |
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Central angle. |
97
|
|
|
* |
98
|
|
|
* @param &array $dom_attributes |
|
|
|
|
99
|
|
|
* @param float|int $radiusTubular |
|
|
|
|
100
|
|
|
* @return void |
101
|
|
|
*/ |
102
|
1 |
|
public function arc(array &$dom_attributes, float $arc) |
103
|
|
|
{ |
104
|
1 |
|
$dom_attributes['arc'] = $arc; |
105
|
1 |
|
} |
106
|
|
|
} |
107
|
|
|
|
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.