[fix] Changed MassCalculator to compare 'MIN_MASS < ', instead of '0=='

This commit is contained in:
Daniel_M_Williams 2020-05-06 15:38:54 -04:00
parent cce900d408
commit 0dc259ab4e

View File

@ -54,7 +54,7 @@ public class MassCalculation {
// =========== Instance Functions ======================== // =========== Instance Functions ========================
public void merge( final MassCalculation other ) { public void merge( final MassCalculation other ) {
if( 0 < other.getMass()) { if( MIN_MASS < other.getMass()) {
// Adjust Center-of-mass // Adjust Center-of-mass
this.addMass( other.getCM() ); this.addMass( other.getCM() );
this.bodies.addAll( other.bodies ); this.bodies.addAll( other.bodies );
@ -66,7 +66,7 @@ public class MassCalculation {
} }
public void addMass( final Coordinate pointMass ) { public void addMass( final Coordinate pointMass ) {
if( 0 == this.centerOfMass.weight ){ if( MIN_MASS < this.centerOfMass.weight ){
this.centerOfMass = pointMass; this.centerOfMass = pointMass;
}else { }else {
this.centerOfMass = this.centerOfMass.average( pointMass); this.centerOfMass = this.centerOfMass.average( pointMass);
@ -298,7 +298,7 @@ public class MassCalculation {
} }
} }
if( 0 < children.getMass() ) { if( MIN_MASS < children.getMass() ) {
this.merge( children ); this.merge( children );
// // vvv DEBUG // // vvv DEBUG
// System.err.println(String.format( "%s....assembly mass (incl/children): %s", prefix, this.toCMDebug())); // System.err.println(String.format( "%s....assembly mass (incl/children): %s", prefix, this.toCMDebug()));
@ -398,7 +398,7 @@ public class MassCalculation {
} }
} }
if( 0 < children.getMass() ) { if( MIN_MASS < children.getMass() ) {
this.merge( children ); this.merge( children );
//System.err.println(String.format( "%s....assembly mass (incl/children): %s", prefix, this.toCMDebug())); //System.err.println(String.format( "%s....assembly mass (incl/children): %s", prefix, this.toCMDebug()));
} }