-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added common function for detecting energy packets crossing an altitu…
…de, see #337
- Loading branch information
Showing
3 changed files
with
21 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2023, University of Colorado Boulder | ||
|
||
import EMEnergyPacket from './EMEnergyPacket.js'; | ||
|
||
/** | ||
* A utility function for testing whether an energy packet has crossed through the provided altitude in either the | ||
* upward or downward moving direction. | ||
* | ||
* @author John Blanco (PhET Interactive Simulations) | ||
*/ | ||
|
||
const energyPacketCrossedAltitude = ( energyPacket: EMEnergyPacket, altitude: number ): boolean => { | ||
return ( energyPacket.previousAltitude > altitude && energyPacket.altitude <= altitude ) || | ||
( energyPacket.previousAltitude < altitude && energyPacket.altitude >= altitude ); | ||
}; | ||
|
||
export default energyPacketCrossedAltitude; |