Skip to content

Commit 722bb09

Browse files
authored
Sphere: Add isSphere flag. (mrdoob#27395)
1 parent b99b3fd commit 722bb09

File tree

6 files changed

+28
-0
lines changed

6 files changed

+28
-0
lines changed

docs/api/ar/math/Sphere.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ <h3>[property:Vector3 center]</h3>
2828
[page:Vector3] يحدد مركز الكرة. الافتراضي هو `(0، 0،
2929
0)`.
3030
</p>
31+
32+
<h3>[property:Boolean isSphere]</h3>
33+
<p>علامة للقراءة فقط للتحقق مما إذا كان كائنًا معينًا من نوع [name].</p>
3134

3235
<h3>[property:Float radius]</h3>
3336
<p>نصف قطر الكرة. الافتراضي هو -1.</p>

docs/api/en/math/Sphere.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ <h3>[property:Vector3 center]</h3>
2929
0)`.
3030
</p>
3131

32+
<h3>[property:Boolean isSphere]</h3>
33+
<p>Read-only flag to check if a given object is of type [name].</p>
34+
3235
<h3>[property:Float radius]</h3>
3336
<p>The radius of the sphere. Default is -1.</p>
3437

docs/api/it/math/Sphere.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ <h2>Proprietà</h2>
2828
<h3>[property:Vector3 center]</h3>
2929
<p>Un [page:Vector3] che definisce il centro della sfera. Il valore predefinito è `(0, 0, 0)`.</p>
3030

31+
<h3>[property:Boolean isSphere]</h3>
32+
<p>
33+
Flag di sola lettura per verificare se l'oggetto dato è di tipo [name].
34+
</p>
35+
3136
<h3>[property:Float radius]</h3>
3237
<p>Il raggio della sfera. Il valore predefinito è -1.</p>
3338

docs/api/zh/math/Sphere.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ <h2>属性</h2>
2828
<h3>[property:Vector3 center]</h3>
2929
<p>A [page:Vector3]定义了球心的位置,默认值位于(0, 0, 0)。</p>
3030

31+
<h3>[property:Boolean isSphere]</h3>
32+
<p>
33+
Read-only flag to check if a given object is of type [name].
34+
</p>
35+
3136
<h3>[property:Float radius]</h3>
3237
<p>球的半径,默认值为-1。</p>
3338

src/math/Sphere.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class Sphere {
99

1010
constructor( center = new Vector3(), radius = - 1 ) {
1111

12+
this.isSphere = true;
13+
1214
this.center = center;
1315
this.radius = radius;
1416

test/unit/src/math/Sphere.tests.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ export default QUnit.module( 'Maths', () => {
3030
} );
3131

3232
// PUBLIC
33+
QUnit.test( 'isSphere', ( assert ) => {
34+
35+
const a = new Sphere();
36+
assert.ok( a.isSphere === true, 'Passed!' );
37+
38+
const b = new Box3();
39+
assert.ok( ! b.isSphere, 'Passed!' );
40+
41+
} );
42+
3343
QUnit.test( 'set', ( assert ) => {
3444

3545
const a = new Sphere();

0 commit comments

Comments
 (0)