Skip to content

Commit

Permalink
Core: Remove checks for mandatory target parameter. (mrdoob#21990)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 authored Jun 16, 2021
1 parent 2272eae commit 4648572
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 253 deletions.
8 changes: 0 additions & 8 deletions src/cameras/Camera.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Matrix4 } from '../math/Matrix4.js';
import { Object3D } from '../core/Object3D.js';
import { Vector3 } from '../math/Vector3.js';

class Camera extends Object3D {

Expand Down Expand Up @@ -32,13 +31,6 @@ class Camera extends Object3D {

getWorldDirection( target ) {

if ( target === undefined ) {

console.warn( 'THREE.Camera: .getWorldDirection() target is now required' );
target = new Vector3();

}

this.updateWorldMatrix( true, false );

const e = this.matrixWorld.elements;
Expand Down
28 changes: 0 additions & 28 deletions src/core/Object3D.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,13 +461,6 @@ class Object3D extends EventDispatcher {

getWorldPosition( target ) {

if ( target === undefined ) {

console.warn( 'THREE.Object3D: .getWorldPosition() target is now required' );
target = new Vector3();

}

this.updateWorldMatrix( true, false );

return target.setFromMatrixPosition( this.matrixWorld );
Expand All @@ -476,13 +469,6 @@ class Object3D extends EventDispatcher {

getWorldQuaternion( target ) {

if ( target === undefined ) {

console.warn( 'THREE.Object3D: .getWorldQuaternion() target is now required' );
target = new Quaternion();

}

this.updateWorldMatrix( true, false );

this.matrixWorld.decompose( _position, target, _scale );
Expand All @@ -493,13 +479,6 @@ class Object3D extends EventDispatcher {

getWorldScale( target ) {

if ( target === undefined ) {

console.warn( 'THREE.Object3D: .getWorldScale() target is now required' );
target = new Vector3();

}

this.updateWorldMatrix( true, false );

this.matrixWorld.decompose( _position, _quaternion, target );
Expand All @@ -510,13 +489,6 @@ class Object3D extends EventDispatcher {

getWorldDirection( target ) {

if ( target === undefined ) {

console.warn( 'THREE.Object3D: .getWorldDirection() target is now required' );
target = new Vector3();

}

this.updateWorldMatrix( true, false );

const e = this.matrixWorld.elements;
Expand Down
28 changes: 0 additions & 28 deletions src/math/Box2.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,26 +78,12 @@ class Box2 {

getCenter( target ) {

if ( target === undefined ) {

console.warn( 'THREE.Box2: .getCenter() target is now required' );
target = new Vector2();

}

return this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );

}

getSize( target ) {

if ( target === undefined ) {

console.warn( 'THREE.Box2: .getSize() target is now required' );
target = new Vector2();

}

return this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );

}
Expand Down Expand Up @@ -148,13 +134,6 @@ class Box2 {
// This can potentially have a divide by zero if the box
// has a size dimension of 0.

if ( target === undefined ) {

console.warn( 'THREE.Box2: .getParameter() target is now required' );
target = new Vector2();

}

return target.set(
( point.x - this.min.x ) / ( this.max.x - this.min.x ),
( point.y - this.min.y ) / ( this.max.y - this.min.y )
Expand All @@ -173,13 +152,6 @@ class Box2 {

clampPoint( point, target ) {

if ( target === undefined ) {

console.warn( 'THREE.Box2: .clampPoint() target is now required' );
target = new Vector2();

}

return target.copy( point ).clamp( this.min, this.max );

}
Expand Down
35 changes: 0 additions & 35 deletions src/math/Box3.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,26 +151,12 @@ class Box3 {

getCenter( target ) {

if ( target === undefined ) {

console.warn( 'THREE.Box3: .getCenter() target is now required' );
target = new Vector3();

}

return this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );

}

getSize( target ) {

if ( target === undefined ) {

console.warn( 'THREE.Box3: .getSize() target is now required' );
target = new Vector3();

}

return this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );

}
Expand Down Expand Up @@ -259,13 +245,6 @@ class Box3 {
// This can potentially have a divide by zero if the box
// has a size dimension of 0.

if ( target === undefined ) {

console.warn( 'THREE.Box3: .getParameter() target is now required' );
target = new Vector3();

}

return target.set(
( point.x - this.min.x ) / ( this.max.x - this.min.x ),
( point.y - this.min.y ) / ( this.max.y - this.min.y ),
Expand Down Expand Up @@ -395,13 +374,6 @@ class Box3 {

clampPoint( point, target ) {

if ( target === undefined ) {

console.warn( 'THREE.Box3: .clampPoint() target is now required' );
target = new Vector3();

}

return target.copy( point ).clamp( this.min, this.max );

}
Expand All @@ -416,13 +388,6 @@ class Box3 {

getBoundingSphere( target ) {

if ( target === undefined ) {

console.error( 'THREE.Box3: .getBoundingSphere() target is now required' );
//target = new Sphere(); // removed to avoid cyclic dependency

}

this.getCenter( target.center );

target.radius = this.getSize( _vector ).length() * 0.5;
Expand Down
7 changes: 0 additions & 7 deletions src/math/Color.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,6 @@ class Color {

// h,s,l ranges are in 0.0 - 1.0

if ( target === undefined ) {

console.warn( 'THREE.Color: .getHSL() target is now required' );
target = { h: 0, s: 0, l: 0 };

}

const r = this.r, g = this.g, b = this.b;

const max = Math.max( r, g, b );
Expand Down
28 changes: 0 additions & 28 deletions src/math/Line3.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,12 @@ class Line3 {

getCenter( target ) {

if ( target === undefined ) {

console.warn( 'THREE.Line3: .getCenter() target is now required' );
target = new Vector3();

}

return target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );

}

delta( target ) {

if ( target === undefined ) {

console.warn( 'THREE.Line3: .delta() target is now required' );
target = new Vector3();

}

return target.subVectors( this.end, this.start );

}
Expand All @@ -71,13 +57,6 @@ class Line3 {

at( t, target ) {

if ( target === undefined ) {

console.warn( 'THREE.Line3: .at() target is now required' );
target = new Vector3();

}

return this.delta( target ).multiplyScalar( t ).add( this.start );

}
Expand Down Expand Up @@ -106,13 +85,6 @@ class Line3 {

const t = this.closestPointToPointParameter( point, clampToLine );

if ( target === undefined ) {

console.warn( 'THREE.Line3: .closestPointToPoint() target is now required' );
target = new Vector3();

}

return this.delta( target ).multiplyScalar( t ).add( this.start );

}
Expand Down
21 changes: 0 additions & 21 deletions src/math/Plane.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,12 @@ class Plane {

projectPoint( point, target ) {

if ( target === undefined ) {

console.warn( 'THREE.Plane: .projectPoint() target is now required' );
target = new Vector3();

}

return target.copy( this.normal ).multiplyScalar( - this.distanceToPoint( point ) ).add( point );

}

intersectLine( line, target ) {

if ( target === undefined ) {

console.warn( 'THREE.Plane: .intersectLine() target is now required' );
target = new Vector3();

}

const direction = line.delta( _vector1 );

const denominator = this.normal.dot( direction );
Expand Down Expand Up @@ -174,13 +160,6 @@ class Plane {

coplanarPoint( target ) {

if ( target === undefined ) {

console.warn( 'THREE.Plane: .coplanarPoint() target is now required' );
target = new Vector3();

}

return target.copy( this.normal ).multiplyScalar( - this.constant );

}
Expand Down
14 changes: 0 additions & 14 deletions src/math/Ray.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ class Ray {

at( t, target ) {

if ( target === undefined ) {

console.warn( 'THREE.Ray: .at() target is now required' );
target = new Vector3();

}

return target.copy( this.direction ).multiplyScalar( t ).add( this.origin );

}
Expand All @@ -67,13 +60,6 @@ class Ray {

closestPointToPoint( point, target ) {

if ( target === undefined ) {

console.warn( 'THREE.Ray: .closestPointToPoint() target is now required' );
target = new Vector3();

}

target.subVectors( point, this.origin );

const directionDistance = target.dot( this.direction );
Expand Down
14 changes: 0 additions & 14 deletions src/math/Sphere.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,6 @@ class Sphere {

const deltaLengthSq = this.center.distanceToSquared( point );

if ( target === undefined ) {

console.warn( 'THREE.Sphere: .clampPoint() target is now required' );
target = new Vector3();

}

target.copy( point );

if ( deltaLengthSq > ( this.radius * this.radius ) ) {
Expand All @@ -134,13 +127,6 @@ class Sphere {

getBoundingBox( target ) {

if ( target === undefined ) {

console.warn( 'THREE.Sphere: .getBoundingBox() target is now required' );
target = new Box3();

}

if ( this.isEmpty() ) {

// Empty sphere produces empty bounding box
Expand Down
Loading

0 comments on commit 4648572

Please sign in to comment.