Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manual/pages/installation.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ <h3>Production</h3>
<i><b>IMPORTANT:</b> Import all dependencies from the same version of three.js, and from the same CDN. Mixing files from different sources may cause duplicate code to be included, or even break the application in unexpected ways.</i>
</p>

<h2>Addons</h2>
<h2 id="addons">Addons</h2>

<p>
Out of the box, three.js includes the fundamentals of a 3D engine. Other three.js components — such as controls, loaders, and post-processing effects — are part of the [link:https://github.com/mrdoob/three.js/tree/dev/examples/jsm addons/] directory. Addons do not need to be <i>installed</i> separately, but do need to be <i>imported</i> separately.
Expand Down
2 changes: 2 additions & 0 deletions src/math/Ray.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ class Ray {
*/
intersectSphere( sphere, target ) {

if ( sphere.radius < 0 ) return null; // handle empty spheres, see #31187

_vector.subVectors( sphere.center, this.origin );
const tca = _vector.dot( this.direction );
const d2 = _vector.dot( _vector ) - tca * tca;
Expand Down
7 changes: 7 additions & 0 deletions test/unit/src/math/Ray.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,13 @@ export default QUnit.module( 'Maths', () => {
a0.intersectSphere( b, point );
assert.ok( point.distanceTo( new Vector3( 0, 0, - 5 ) ) < TOL, 'Passed!' );

// empty sphere ( negative radius ) can never be intersected, so the
// target must be left untouched and the return value must be null,
// consistent with intersectsSphere()
b = new Sphere( new Vector3( 0, 0, - 1 ), - 1 );
assert.strictEqual( a0.intersectSphere( b, point.copy( posInf3 ) ), null, 'Passed!' );
assert.ok( point.equals( posInf3 ), 'Passed!' );

} );

QUnit.test( 'intersectsSphere', ( assert ) => {
Expand Down
2 changes: 1 addition & 1 deletion utils/docs/template/tmpl/container.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<article>
<?js if (doc.import) { ?>
<h2 class="subsection-title">Import</h2>
<p><span translate="no"><?js= doc.name ?></span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#installation">Installation#Addons</a>.</p>
<p><span translate="no"><?js= doc.name ?></span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#installation#addons">Installation#Addons</a>.</p>
<pre class="prettyprint source lang-js" translate="no"><code><?js= doc.import ?></code></pre>
<?js } ?>
<div class="container-overview">
Expand Down
Loading