Add equals check for new length

This commit is contained in:
SiboVG 2022-08-22 09:54:37 +02:00
parent b7752cde70
commit 3793eb19c6

View File

@ -77,7 +77,10 @@ public abstract class MassObject extends InternalComponent {
// Calculate the parachute volume using the auto radius and the new "auto" length, and transform that back
// to the non auto radius situation to set this.length (the volume in both situations is the same).
double parachuteVolume = Math.pow(getRadius(), 2) * length; // Math.PI left out, not needed
this.length = parachuteVolume / Math.pow(this.radius, 2);
double newLength = parachuteVolume / Math.pow(this.radius, 2);
if (MathUtil.equals(this.length, newLength))
return;
this.length = newLength;
} else {
if (MathUtil.equals(this.length, length)) {
return;