From 3793eb19c6d92d0e8f8768ed033ee93df8865007 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Mon, 22 Aug 2022 09:54:37 +0200 Subject: [PATCH] Add equals check for new length --- core/src/net/sf/openrocket/rocketcomponent/MassObject.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/MassObject.java b/core/src/net/sf/openrocket/rocketcomponent/MassObject.java index 394a9ac0c..2058d1b72 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/MassObject.java +++ b/core/src/net/sf/openrocket/rocketcomponent/MassObject.java @@ -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;