1
|
|
|
<?php |
2
|
|
|
/** @formatter:off |
3
|
|
|
* ****************************************************************** |
4
|
|
|
* Created by Marko Kungla on Jul 7, 2016 - 7:46:31 PM |
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 Ring.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\Extras\Primitives; |
25
|
|
|
|
26
|
|
|
use \AframeVR\Core\Entity; |
27
|
|
|
use \AframeVR\Interfaces\EntityInterface; |
28
|
|
|
|
29
|
|
|
final class Ring extends Entity implements EntityInterface |
30
|
|
|
{ |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Reset <a-ring> |
34
|
|
|
* |
35
|
|
|
* The ring primitive creates a ring or disc shape. It is an entity that prescribes the geometry with its geometric |
36
|
|
|
* primitive set to ring. |
37
|
|
|
* |
38
|
|
|
* @return void |
39
|
|
|
*/ |
40
|
1 |
|
public function reset() |
41
|
|
|
{ |
42
|
1 |
|
parent::reset(); |
43
|
1 |
|
$this->component('Geometry')->primitive('ring'); |
44
|
1 |
|
$this->radiusInner(0.8); |
45
|
1 |
|
$this->radiusOuter(1.2); |
46
|
1 |
|
$this->segmentsPhi(10); |
47
|
1 |
|
$this->segmentsTheta(32); |
48
|
1 |
|
$this->thetaLength(360); |
49
|
1 |
|
$this->thetaStart(0); |
50
|
1 |
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Radius of the inner hole of the ring. |
54
|
|
|
* |
55
|
|
|
* @param float $radiusInner |
56
|
|
|
* @return self |
|
|
|
|
57
|
|
|
*/ |
58
|
1 |
|
public function radiusInner(float $radiusInner): self |
59
|
|
|
{ |
60
|
1 |
|
$this->component('Geometry')->radiusInner($radiusInner); |
61
|
1 |
|
return $this; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Radius of the outer edge of the ring. |
66
|
|
|
* |
67
|
|
|
* @param float $radiusOuter |
68
|
|
|
* @return self |
|
|
|
|
69
|
|
|
*/ |
70
|
1 |
|
public function radiusOuter(float $radiusOuter): self |
71
|
|
|
{ |
72
|
1 |
|
$this->component('Geometry')->radiusOuter($radiusOuter); |
73
|
1 |
|
return $this; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Number of triangles within each face defined by segmentsTheta. |
78
|
|
|
* |
79
|
|
|
* @param int $segmentsPhi |
80
|
|
|
* @return self |
|
|
|
|
81
|
|
|
*/ |
82
|
1 |
|
public function segmentsPhi(int $segmentsPhi): self |
83
|
|
|
{ |
84
|
1 |
|
$this->component('Geometry')->segmentsPhi($segmentsPhi); |
85
|
1 |
|
return $this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Number of segments. |
90
|
|
|
* A higher number means the ring will be more round. |
91
|
|
|
* |
92
|
|
|
* @param int $segmentsTheta |
93
|
|
|
* @return self |
|
|
|
|
94
|
|
|
*/ |
95
|
1 |
|
public function segmentsTheta(int $segmentsTheta): self |
96
|
|
|
{ |
97
|
1 |
|
$this->component('Geometry')->segmentsTheta($segmentsTheta); |
98
|
1 |
|
return $this; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Central angle in degrees. |
103
|
|
|
* |
104
|
|
|
* @param float $thetaLength |
105
|
|
|
* @return self |
|
|
|
|
106
|
|
|
*/ |
107
|
1 |
|
public function thetaLength(float $thetaLength): self |
108
|
|
|
{ |
109
|
1 |
|
$this->component('Geometry')->thetaLength($thetaLength); |
110
|
1 |
|
return $this; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Starting angle in degrees. |
115
|
|
|
* |
116
|
|
|
* @param float $thetaStart |
117
|
|
|
* @return self |
|
|
|
|
118
|
|
|
*/ |
119
|
1 |
|
public function thetaStart(float $thetaStart): self |
120
|
|
|
{ |
121
|
1 |
|
$this->component('Geometry')->thetaStart($thetaStart); |
122
|
1 |
|
return $this; |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.