Skip to content

Commit

Permalink
Cleanup in CoilModel, see #86
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Nov 4, 2017
1 parent a0f6c7d commit be9a60b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 3 additions & 5 deletions js/faradays-law/model/CoilModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,21 @@ define( function( require ) {
var faradaysLaw = require( 'FARADAYS_LAW/faradaysLaw' );
var inherit = require( 'PHET_CORE/inherit' );
var Property = require( 'AXON/Property' );
var Vector2 = require( 'DOT/Vector2' );

/**
* @param {number} x - centerX of the coil
* @param {number} y - centerY of the coil
* @param {Vector2} position - center of the coil
* @param {number} numberOfSpirals - number of spirals
* @param {MagnetModel} magnetModel - model of the magnet
* @constructor
*/
function CoilModel( x, y, numberOfSpirals, magnetModel ) {
function CoilModel( position, numberOfSpirals, magnetModel ) {
var self = this;

// @private
this.sense = 1; //sense of magnet = +1 or -1, simulates flipping of magnet. Magnetic field sign

// @public (read-only) // TODO convert args to Vector2
this.position = new Vector2( x, y );
this.position = position;

// @private - current value of magnetic field
this.magneticFieldProperty = new Property( 0 );
Expand Down
5 changes: 3 additions & 2 deletions js/faradays-law/model/FaradaysLawModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ define( function( require ) {
var inherit = require( 'PHET_CORE/inherit' );
var MagnetModel = require( 'FARADAYS_LAW/faradays-law/model/MagnetModel' );
var Property = require( 'AXON/Property' );
var Vector2 = require( 'DOT/Vector2' );
var VoltmeterModel = require( 'FARADAYS_LAW/faradays-law/model/VoltmeterModel' );

// phet-io modules
Expand Down Expand Up @@ -48,8 +49,8 @@ define( function( require ) {
this.magnetModel = new MagnetModel( 647, 219, 140, 30, tandem.createTandem( 'magnetModel' ) );

// coils
this.bottomCoil = new CoilModel( 448, 328, 4, this.magnetModel );
this.topCoil = new CoilModel( 422, 131, 2, this.magnetModel );
this.bottomCoil = new CoilModel( new Vector2( 448, 328 ), 4, this.magnetModel );
this.topCoil = new CoilModel( new Vector2( 422, 131 ), 2, this.magnetModel );

// restricted zones for magnet because of coils
var TWO_COIL_RESTRICTED_BOUNDS = new Bounds2( 0, 0, 25, 11 );
Expand Down

0 comments on commit be9a60b

Please sign in to comment.