Skip to content

Commit

Permalink
backed out the concave bottom because it caused sliding at absolute z…
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Aug 1, 2018
1 parent c5b671e commit d53d8af
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions js/common/model/engine/AbstractVerletAlgorithm.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ define( function( require ) {
// threshold to compare to zero, necessary due to floating point variations
var COMPARE_THRESHOLD = 1E-5;

// a factor that controls how concave the bottom is, value empirically determined, see usage
var BOTTOM_CONCAVITY_FACTOR = 0.1;

/**
* @param {MultipleParticleModel} multipleParticleModel of the simulation
* @constructor
Expand Down Expand Up @@ -59,9 +56,6 @@ define( function( require ) {

// @private, tracks time above the explosion threshold
this.timeAboveExplosionPressure = 0;

// @private, middle X position of the container
this.middleX = this.multipleParticleModel.normalizedContainerWidth / 2;
}

statesOfMatter.register( 'AbstractVerletAlgorithm', AbstractVerletAlgorithm );
Expand Down Expand Up @@ -152,12 +146,6 @@ define( function( require ) {
if ( yPos <= minY && moleculeVelocityY <= 0 ) {
yPos = minY;
moleculeVelocity.y = -moleculeVelocityY;

// simulate a slight concavity in order to keep the substance centered if sitting on the bottom
var deltaXFromCenter = xPos - this.middleX;
var sign = deltaXFromCenter >= 0 ? -1 : 1;
var xAdjustmentDueToConvexBottom = timeStep * sign * Math.pow( deltaXFromCenter, 2 ) * BOTTOM_CONCAVITY_FACTOR;
moleculeVelocity.x += xAdjustmentDueToConvexBottom;
}

// handle bounce off the top
Expand Down

0 comments on commit d53d8af

Please sign in to comment.