Skip to content

Commit

Permalink
update dragCoefficient range to support all possibilities, #218 #217
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Dec 12, 2019
1 parent f66a7d8 commit 868b0d3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion js/common/ProjectileMotionConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ define( require => {

PROJECTILE_MASS_RANGE: new Range( .01, 5000 ), // in original, highest is 1000
PROJECTILE_DIAMETER_RANGE: new Range( 0.01, 3 ), // in original, smallest is 0.043
PROJECTILE_DRAG_COEFFICIENT_RANGE: new Range( 0.04, 1 ), // teardrop to almost hemisphere shape
PROJECTILE_DRAG_COEFFICIENT_RANGE: new Range( 0.04, 1.2 ), // teardrop to almost hemisphere shape

ALTITUDE_RANGE: new Range( 0, 5000 ), // meters, max is arbitrary but in upper stratosphere
GRAVITY_RANGE: new Range( 5, 20 ), // in m/s/s
Expand Down
3 changes: 2 additions & 1 deletion js/common/model/ProjectileMotionModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ define( require => {
// @public {Property.<number>}
this.projectileDragCoefficientProperty = new NumberProperty( defaultProjectileObjectType.dragCoefficient, {
tandem: tandem.createTandem( 'projectileDragCoefficientProperty' ),
phetioDocumentation: 'Drag coefficient of the projectile, unitless as it is a coefficient'
phetioDocumentation: 'Drag coefficient of the projectile, unitless as it is a coefficient',
range: ProjectileMotionConstants.PROJECTILE_DRAG_COEFFICIENT_RANGE
} );

// @public {Property.<ProjectileObjectType>}
Expand Down
9 changes: 7 additions & 2 deletions js/common/model/ProjectileObjectType.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ define( require => {
massRound: 1,
diameterRange: new Range( 0.1, 1 ),
diameterRound: 0.1,
dragCoefficientRange: new Range( 0.04, 1 ),

// most objectTypes have a max of 1
dragCoefficientRange: new Range( ProjectileMotionConstants.PROJECTILE_DRAG_COEFFICIENT_RANGE.min, 1 ),
viewCreationFunction: null
}, options );

Expand Down Expand Up @@ -196,13 +198,16 @@ define( require => {
pianoString,
400,
2.2,
1.2,
ProjectileMotionConstants.PROJECTILE_DRAG_COEFFICIENT_RANGE.max,
'piano',
false, {
massRange: new Range( 50, 1000 ),
massRound: 1,
diameterRange: new Range( 0.5, 3 ),
diameterRound: 0.1,

// the piano can accept all drag coefficient ranges
dragCoefficientRange: ProjectileMotionConstants.PROJECTILE_DRAG_COEFFICIENT_RANGE,
viewCreationFunction: ProjectileObjectViewFactory.createPiano,
tandem: objectTypesTandem.createTandem( 'piano' )
}
Expand Down

0 comments on commit 868b0d3

Please sign in to comment.