Skip to content

Commit

Permalink
move isIRWavelength and isUVWavelength to VisibleColor, #118
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Feb 13, 2025
1 parent 4e29bb0 commit d467b8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
17 changes: 1 addition & 16 deletions js/common/MOTHAUtils.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// Copyright 2016-2025, University of Colorado Boulder

/**
* MOTHAUtils is a collection of static utility functions used in this sim.
* MOTHAUtils is a collection of utility functions used in this sim.
*
* @author Chris Malley (PixelZoom, Inc.)
*/

import dotRandom from '../../../dot/js/dotRandom.js';
import Vector2 from '../../../dot/js/Vector2.js';
import modelsOfTheHydrogenAtom from '../modelsOfTheHydrogenAtom.js';
import VisibleColor from '../../../scenery-phet/js/VisibleColor.js';

const MOTHAUtils = {

Expand Down Expand Up @@ -44,20 +43,6 @@ const MOTHAUtils = {
*/
pointsCollide( position1: Vector2, position2: Vector2, maxDistance: number ): boolean {
return position1.distance( position2 ) <= maxDistance;
},

/**
* Is the given wavelength in the UV spectrum?
*/
isUV( wavelength: number ): boolean {
return wavelength < VisibleColor.MIN_WAVELENGTH;
},

/**
* Is the given wavelength in the IR spectrum?
*/
isIR( wavelength: number ): boolean {
return wavelength > VisibleColor.MAX_WAVELENGTH;
}
};

Expand Down
5 changes: 2 additions & 3 deletions js/energylevels/view/EnergySquiggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import VisibleColor from '../../../../scenery-phet/js/VisibleColor.js';
import Node from '../../../../scenery/js/nodes/Node.js';
import Path from '../../../../scenery/js/nodes/Path.js';
import MOTHAColors from '../../common/MOTHAColors.js';
import MOTHAUtils from '../../common/MOTHAUtils.js';
import modelsOfTheHydrogenAtom from '../../modelsOfTheHydrogenAtom.js';
import distanceXY from '../../../../dot/js/util/distanceXY.js';

Expand Down Expand Up @@ -138,10 +137,10 @@ export default class EnergySquiggle extends Node {
*/
function wavelengthToPeriod( wavelength: number ): number {
let period = 0;
if ( MOTHAUtils.isUV( wavelength ) ) {
if ( VisibleColor.isUVWavelength( wavelength ) ) {
period = UV_SQUIGGLE_PERIOD;
}
else if ( MOTHAUtils.isIR( wavelength ) ) {
else if ( VisibleColor.isIRWavelength( wavelength ) ) {
period = IR_SQUIGGLE_PERIOD;
}
else {
Expand Down

0 comments on commit d467b8a

Please sign in to comment.