Skip to content

Commit

Permalink
Rename DOT/Util and SCENERY/Util to Utils, see phetsims/tasks#966
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Dec 30, 2019
1 parent 71813bd commit f967380
Show file tree
Hide file tree
Showing 18 changed files with 375 additions and 375 deletions.
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports = function( grunt ) {
Sphere3: 'sphere3',
Transform3: 'transform3',
Transform4: 'transform4',
Util: 'util',
Utils: 'util',
Vector2: 'vector2',
Vector3: 'vector3',
Vector4: 'vector4'
Expand Down Expand Up @@ -82,7 +82,7 @@ module.exports = function( grunt ) {
docFile( 'js/Dimension2.js', 'Dimension2', [ 'Dimension2' ] );
docFile( 'js/Transform3.js', 'Transform3', [ 'Transform3' ] );
docFile( 'js/Transform4.js', 'Transform4', [ 'Transform4' ] );
docFile( 'js/Util.js', 'Util', [ 'Util' ] );
docFile( 'js/Utils.js', 'Utils', [ 'Utils' ] );
docFile( 'js/Vector2.js', 'Vector2', [ 'Vector2' ] );
docFile( 'js/Vector3.js', 'Vector3', [ 'Vector3' ] );
docFile( 'js/Vector4.js', 'Vector4', [ 'Vector4' ] );
Expand Down
66 changes: 33 additions & 33 deletions doc/index.html

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions js/Complex.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ define( require => {
'use strict';

const dot = require( 'DOT/dot' );
require( 'DOT/Util' );
require( 'DOT/Utils' );
const inherit = require( 'PHET_CORE/inherit' );

/**
Expand Down Expand Up @@ -212,8 +212,8 @@ define( require => {
*/
sinOf: function() {
return new Complex(
Math.sin( this.real ) * dot.Util.cosh( this.imaginary ),
Math.cos( this.real ) * dot.Util.sinh( this.imaginary )
Math.sin( this.real ) * dot.Utils.cosh( this.imaginary ),
Math.cos( this.real ) * dot.Utils.sinh( this.imaginary )
);
},

Expand All @@ -226,8 +226,8 @@ define( require => {
*/
cosOf: function() {
return new Complex(
Math.cos( this.real ) * dot.Util.cosh( this.imaginary ),
- Math.sin( this.real ) * dot.Util.sinh( this.imaginary )
Math.cos( this.real ) * dot.Utils.cosh( this.imaginary ),
- Math.sin( this.real ) * dot.Utils.sinh( this.imaginary )
);
},

Expand Down Expand Up @@ -430,8 +430,8 @@ define( require => {
*/
sin: function() {
return this.setRealImaginary(
Math.sin( this.real ) * dot.Util.cosh( this.imaginary ),
Math.cos( this.real ) * dot.Util.sinh( this.imaginary )
Math.sin( this.real ) * dot.Utils.cosh( this.imaginary ),
Math.cos( this.real ) * dot.Utils.sinh( this.imaginary )
);
},

Expand All @@ -444,8 +444,8 @@ define( require => {
*/
cos: function() {
return this.setRealImaginary(
Math.cos( this.real ) * dot.Util.cosh( this.imaginary ),
- Math.sin( this.real ) * dot.Util.sinh( this.imaginary )
Math.cos( this.real ) * dot.Utils.cosh( this.imaginary ),
- Math.sin( this.real ) * dot.Utils.sinh( this.imaginary )
);
},

Expand Down
20 changes: 10 additions & 10 deletions js/DelaunayTriangulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ define( require => {
const dot = require( 'DOT/dot' );
const inherit = require( 'PHET_CORE/inherit' );
const merge = require( 'PHET_CORE/merge' );
const Util = require( 'DOT/Util' );
const Utils = require( 'DOT/Utils' );
const Vector2 = require( 'DOT/Vector2' );

/**
Expand Down Expand Up @@ -271,7 +271,7 @@ define( require => {
const middleVertex = rightFrontEdge.endVertex;

while ( rightFrontEdge.previousEdge &&
Util.triangleAreaSigned( middleVertex.point, rightFrontEdge.startVertex.point, rightFrontEdge.previousEdge.startVertex.point ) > 0 &&
Utils.triangleAreaSigned( middleVertex.point, rightFrontEdge.startVertex.point, rightFrontEdge.previousEdge.startVertex.point ) > 0 &&
( middleVertex.point.minus( rightFrontEdge.startVertex.point ) ).angleBetween( rightFrontEdge.previousEdge.startVertex.point.minus( rightFrontEdge.startVertex.point ) ) < Math.PI / 2 ) {
const previousEdge = rightFrontEdge.previousEdge;
const newRightEdge = new Edge( previousEdge.startVertex, middleVertex );
Expand All @@ -286,7 +286,7 @@ define( require => {
rightFrontEdge = newRightEdge;
}
while ( leftFrontEdge.nextEdge &&
Util.triangleAreaSigned( middleVertex.point, leftFrontEdge.nextEdge.endVertex.point, leftFrontEdge.endVertex.point ) > 0 &&
Utils.triangleAreaSigned( middleVertex.point, leftFrontEdge.nextEdge.endVertex.point, leftFrontEdge.endVertex.point ) > 0 &&
( middleVertex.point.minus( leftFrontEdge.endVertex.point ) ).angleBetween( leftFrontEdge.nextEdge.endVertex.point.minus( leftFrontEdge.endVertex.point ) ) < Math.PI / 2 ) {
const nextEdge = leftFrontEdge.nextEdge;
const newLeftEdge = new Edge( middleVertex, nextEdge.endVertex );
Expand Down Expand Up @@ -474,7 +474,7 @@ define( require => {
const startVertex = edge.getOtherVertex( sharedVertex );
const endVertex = nextEdge.getOtherVertex( sharedVertex );

if ( Util.triangleAreaSigned( startVertex.point, sharedVertex.point, endVertex.point ) <= 0 ) {
if ( Utils.triangleAreaSigned( startVertex.point, sharedVertex.point, endVertex.point ) <= 0 ) {
continue;
}

Expand Down Expand Up @@ -563,7 +563,7 @@ define( require => {
for ( var i = 0; i < frontEdges.length - 1; i++ ) {
var firstEdge = frontEdges[ i ];
var secondEdge = frontEdges[ i + 1 ];
if ( Util.triangleAreaSigned( secondEdge.endVertex.point, firstEdge.endVertex.point, firstEdge.startVertex.point ) > 1e-10 ) {
if ( Utils.triangleAreaSigned( secondEdge.endVertex.point, firstEdge.endVertex.point, firstEdge.startVertex.point ) > 1e-10 ) {
var newEdge = this.fillBorderTriangle( firstEdge, secondEdge, firstEdge.startVertex, firstEdge.endVertex, secondEdge.endVertex );
frontEdges.splice( i, 2, newEdge );
// start scanning from behind where we were previously (if possible)
Expand Down Expand Up @@ -619,7 +619,7 @@ define( require => {
sharedVertex = firstEdge.getSharedVertex( secondEdge );
const firstVertex = firstEdge.getOtherVertex( sharedVertex );
const secondVertex = secondEdge.getOtherVertex( sharedVertex );
if ( Util.triangleAreaSigned( secondVertex.point, sharedVertex.point, firstVertex.point ) > 1e-10 ) {
if ( Utils.triangleAreaSigned( secondVertex.point, sharedVertex.point, firstVertex.point ) > 1e-10 ) {
newEdge = this.fillBorderTriangle( firstEdge, secondEdge, firstVertex, sharedVertex, secondVertex );
backEdges.splice( i, 2, newEdge );
// start scanning from behind where we were previously (if possible)
Expand Down Expand Up @@ -659,8 +659,8 @@ define( require => {
const farVertex1 = triangle1.getVertexOppositeFromEdge( edge );
const farVertex2 = triangle2.getVertexOppositeFromEdge( edge );

if ( Util.pointInCircleFromPoints( triangle1.aVertex.point, triangle1.bVertex.point, triangle1.cVertex.point, farVertex2.point ) ||
Util.pointInCircleFromPoints( triangle2.aVertex.point, triangle2.bVertex.point, triangle2.cVertex.point, farVertex1.point ) ) {
if ( Utils.pointInCircleFromPoints( triangle1.aVertex.point, triangle1.bVertex.point, triangle1.cVertex.point, farVertex2.point ) ||
Utils.pointInCircleFromPoints( triangle2.aVertex.point, triangle2.bVertex.point, triangle2.cVertex.point, farVertex1.point ) ) {
// TODO: better helper functions for adding/removing triangles (takes care of the edge stuff)
triangle1.remove();
triangle2.remove();
Expand Down Expand Up @@ -952,7 +952,7 @@ define( require => {
* @returns {boolean}
*/
intersectsConstrainedEdge: function( vertex, bottomVertex ) {
return Util.lineSegmentIntersection( vertex.point.x, vertex.point.y, bottomVertex.point.x, bottomVertex.point.y,
return Utils.lineSegmentIntersection( vertex.point.x, vertex.point.y, bottomVertex.point.x, bottomVertex.point.y,
this.startVertex.point.x, this.startVertex.point.y,
this.endVertex.point.x, this.endVertex.point.y );
}
Expand Down Expand Up @@ -992,7 +992,7 @@ define( require => {
assert && assert( cVertex === aEdge.startVertex || cVertex === aEdge.endVertex, 'cVertex should be in aEdge' );
assert && assert( cVertex === bEdge.startVertex || cVertex === bEdge.endVertex, 'cVertex should be in bEdge' );

assert && assert( Util.triangleAreaSigned( aVertex.point, bVertex.point, cVertex.point ) > 0,
assert && assert( Utils.triangleAreaSigned( aVertex.point, bVertex.point, cVertex.point ) > 0,
'Should be counterclockwise' );

// @public {Vertex}
Expand Down
6 changes: 3 additions & 3 deletions js/LinearFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ define( require => {
const dot = require( 'DOT/dot' );

// modules
require( 'DOT/Util' );
require( 'DOT/Utils' );

/**
* @param {number} a1
Expand Down Expand Up @@ -48,11 +48,11 @@ define( require => {
* @returns {number}
*/
const map = function( a1, a2, b1, b2, a3, clamp ) {
let b3 = dot.Util.linear( a1, a2, b1, b2, a3 );
let b3 = dot.Utils.linear( a1, a2, b1, b2, a3 );
if ( clamp ) {
const max = Math.max( b1, b2 );
const min = Math.min( b1, b2 );
b3 = dot.Util.clamp( b3, min, max );
b3 = dot.Utils.clamp( b3, min, max );
}
return b3;
};
Expand Down
2 changes: 1 addition & 1 deletion js/Permutation.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ define( require => {
const dot = require( 'DOT/dot' );

const isArray = require( 'PHET_CORE/isArray' );
require( 'DOT/Util' ); // for rangeInclusive
require( 'DOT/Utils' ); // for rangeInclusive

// Creates a permutation that will rearrange a list so that newList[i] = oldList[permutation[i]]
function Permutation( indices ) {
Expand Down
6 changes: 3 additions & 3 deletions js/PiecewiseLinearFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ define( require => {
'use strict';

const dot = require( 'DOT/dot' );
const Util = require( 'DOT/Util' );
const Utils = require( 'DOT/Utils' );

// modules
require( 'DOT/Util' );
require( 'DOT/Utils' );

class PiecewiseLinearFunction {

Expand Down Expand Up @@ -70,7 +70,7 @@ define( require => {
const anchor1Y = array[ lowerIndex + 1 ];
const anchor2X = array[ upperIndex ];
const anchor2Y = array[ upperIndex + 1 ];
return Util.linear( anchor1X, anchor2X, anchor1Y, anchor2Y, x );
return Utils.linear( anchor1X, anchor2X, anchor1Y, anchor2Y, x );
}
}

Expand Down
2 changes: 1 addition & 1 deletion js/Quaternion.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define( require => {
const Poolable = require( 'PHET_CORE/Poolable' );
require( 'DOT/Vector3' );
require( 'DOT/Matrix3' );
require( 'DOT/Util' );
require( 'DOT/Utils' );

/**
* Quaternion defines hypercomplex numbers of the form {x, y, z, w}
Expand Down
8 changes: 4 additions & 4 deletions js/Random.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ define( require => {
const dot = require( 'DOT/dot' );
const inherit = require( 'PHET_CORE/inherit' );
const merge = require( 'PHET_CORE/merge' );
const Util = require( 'DOT/Util' );
const Utils = require( 'DOT/Utils' );

/**
* Construct a Random instance.
Expand Down Expand Up @@ -91,8 +91,8 @@ define( require => {
nextIntBetween: function( min, max ) {

assert && assert( arguments.length === 2, 'nextIntBetween must have exactly 2 arguments' );
assert && assert( Util.isInteger( min ), 'min must be an integer: ' + min );
assert && assert( Util.isInteger( max ), 'max must be an integer: ' + max );
assert && assert( Utils.isInteger( min ), 'min must be an integer: ' + min );
assert && assert( Utils.isInteger( max ), 'max must be an integer: ' + max );

const range = max - min;
return this.nextInt( range + 1 ) + min;
Expand Down Expand Up @@ -160,7 +160,7 @@ define( require => {
* @returns {number}
*/
nextGaussian: function() {
return Util.boxMullerTransform( 0, 1, this );
return Utils.boxMullerTransform( 0, 1, this );
}
} );

Expand Down
Loading

0 comments on commit f967380

Please sign in to comment.