1
|
|
|
<?php |
2
|
|
|
/** @formatter:off |
3
|
|
|
* ****************************************************************** |
4
|
|
|
* Created by Marko Kungla on Jun 27, 2016 - 6:05:03 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 TorusKnotMethods.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 TorusKnotMethods |
27
|
|
|
{ |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* The torus knot primitive defines a pretzel shape, the particular shape of which is defined by a pair of coprime integers, |
31
|
|
|
* p and q. |
32
|
|
|
* If p and q are not coprime the result will be a torus link. |
33
|
|
|
*/ |
34
|
|
|
const DEFAULTS = array( |
35
|
|
|
/* Radius that contains the torus knot. */ |
36
|
|
|
'radius' => 1, |
37
|
|
|
/* Radius of the tubes of the torus knot. */ |
38
|
|
|
'radiusTubular' => 0.2, |
39
|
|
|
/* Number of segments along the circumference of the tube ends. A higher number means the tube will be more round. */ |
40
|
|
|
'segmentsRadial' => 36, |
41
|
|
|
/* Number of segments along the circumference of the tube face. A higher number means the tube will be more round. */ |
42
|
|
|
'segmentsTubular' => 32, |
43
|
|
|
/* Number that helps define the pretzel shape. */ |
44
|
|
|
'p' => 2, |
45
|
|
|
/* Number that helps define the pretzel shape. */ |
46
|
|
|
'q' => 3 |
47
|
|
|
); |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Radius that contains the torus knot. |
51
|
|
|
* |
52
|
|
|
* @param &array $dom_attributes |
|
|
|
|
53
|
|
|
* @param float|int $radius |
|
|
|
|
54
|
|
|
* @return void |
55
|
|
|
*/ |
56
|
1 |
|
public function radius(array &$dom_attributes, float $radius) |
57
|
|
|
{ |
58
|
1 |
|
$dom_attributes['radius'] = $radius; |
59
|
1 |
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Radius of the tubes of the torus knot. |
63
|
|
|
* |
64
|
|
|
* @param &array $dom_attributes |
|
|
|
|
65
|
|
|
* @param float|int $radiusTubular |
|
|
|
|
66
|
|
|
* @return void |
67
|
|
|
*/ |
68
|
1 |
|
public function radiusTubular(array &$dom_attributes, float $radiusTubular) |
69
|
|
|
{ |
70
|
1 |
|
$dom_attributes['radiusTubular'] = $radiusTubular; |
71
|
1 |
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Number of segments along the circumference of the tube ends. |
75
|
|
|
* A higher number means the tube will be more round. |
76
|
|
|
* |
77
|
|
|
* @param &array $dom_attributes |
|
|
|
|
78
|
|
|
* @param int $segmentsRadial |
79
|
|
|
* @return void |
80
|
|
|
*/ |
81
|
1 |
|
public function segmentsRadial(array &$dom_attributes, int $segmentsRadial) |
82
|
|
|
{ |
83
|
1 |
|
$dom_attributes['segmentsRadial'] = $segmentsRadial; |
84
|
1 |
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Number of segments along the circumference of the tube face. |
88
|
|
|
* A higher number means the tube will be more round. |
89
|
|
|
* |
90
|
|
|
* @param &array $dom_attributes |
|
|
|
|
91
|
|
|
* @param int $segmentsTubular |
92
|
|
|
* @return void |
93
|
|
|
*/ |
94
|
1 |
|
public function segmentsTubular(array &$dom_attributes, int $segmentsTubular) |
95
|
|
|
{ |
96
|
1 |
|
$dom_attributes['segmentsTubular'] = $segmentsTubular; |
97
|
1 |
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Number that helps define the pretzel shape. |
101
|
|
|
* |
102
|
|
|
* @param &array $dom_attributes |
|
|
|
|
103
|
|
|
* @param int $p |
104
|
|
|
* @return void |
105
|
|
|
*/ |
106
|
1 |
|
public function p(array &$dom_attributes, int $p) |
107
|
|
|
{ |
108
|
1 |
|
$dom_attributes['p'] = $p; |
109
|
1 |
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Number that helps define the pretzel shape. |
113
|
|
|
* |
114
|
|
|
* @param &array $dom_attributes |
|
|
|
|
115
|
|
|
* @param int $q |
116
|
|
|
* @return void |
117
|
|
|
*/ |
118
|
1 |
|
public function q(array &$dom_attributes, int $q) |
119
|
|
|
{ |
120
|
1 |
|
$dom_attributes['q'] = $q; |
121
|
1 |
|
} |
122
|
|
|
} |
123
|
|
|
|
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.