Ring::segmentsPhi()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
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 2
    public function reset()
41
    {
42 2
        parent::reset();
43 2
        $this->attr('Geometry')->primitive('ring');
44 2
        $this->radiusInner(0.8);
45 2
        $this->radiusOuter(1.2);
46 2
        $this->segmentsPhi(10);
47 2
        $this->segmentsTheta(32);
48 2
        $this->thetaLength(360);
49 2
        $this->thetaStart(0);
50 2
    }
51
52
    /**
53
     * Radius of the inner hole of the ring.
54
     *
55
     * @param float $radiusInner            
56
     * @return Ring
57
     */
58 2
    public function radiusInner(float $radiusInner)
59
    {
60 2
        $this->attr('Geometry')->radiusInner($radiusInner);
61 2
        return $this;
62
    }
63
64
    /**
65
     * Radius of the outer edge of the ring.
66
     *
67
     * @param float $radiusOuter            
68
     * @return Ring
69
     */
70 2
    public function radiusOuter(float $radiusOuter)
71
    {
72 2
        $this->attr('Geometry')->radiusOuter($radiusOuter);
73 2
        return $this;
74
    }
75
76
    /**
77
     * Number of triangles within each face defined by segmentsTheta.
78
     *
79
     * @param int $segmentsPhi            
80
     * @return Ring
81
     */
82 2
    public function segmentsPhi(int $segmentsPhi)
83
    {
84 2
        $this->attr('Geometry')->segmentsPhi($segmentsPhi);
85 2
        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 Ring
94
     */
95 2
    public function segmentsTheta(int $segmentsTheta)
96
    {
97 2
        $this->attr('Geometry')->segmentsTheta($segmentsTheta);
98 2
        return $this;
99
    }
100
101
    /**
102
     * Central angle in degrees.
103
     *
104
     * @param float $thetaLength            
105
     * @return Ring
106
     */
107 2
    public function thetaLength(float $thetaLength)
108
    {
109 2
        $this->attr('Geometry')->thetaLength($thetaLength);
110 2
        return $this;
111
    }
112
113
    /**
114
     * Starting angle in degrees.
115
     *
116
     * @param float $thetaStart            
117
     * @return Ring
118
     */
119 2
    public function thetaStart(float $thetaStart)
120
    {
121 2
        $this->attr('Geometry')->thetaStart($thetaStart);
122 2
        return $this;
123
    }
124
}
125