From 7ff06980b22e8c35bbe0ce67b3ceefcc3b2ab3cc Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Wed, 28 Dec 2022 11:36:10 -0700 Subject: [PATCH] Use string displaying diameters instead of mathematical comparison of diameters to set discontinuity warning --- .../sf/openrocket/aerodynamics/BarrowmanCalculator.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java index 96ae2c947..264c1298b 100644 --- a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java +++ b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java @@ -21,6 +21,7 @@ import net.sf.openrocket.rocketcomponent.InstanceMap; import net.sf.openrocket.rocketcomponent.Rocket; import net.sf.openrocket.rocketcomponent.RocketComponent; import net.sf.openrocket.rocketcomponent.SymmetricComponent; +import net.sf.openrocket.unit.UnitGroup; import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.MathUtil; import net.sf.openrocket.util.PolyInterpolator; @@ -305,7 +306,11 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { } } else { // Check for radius discontinuity - if ( !MathUtil.equals(sym.getForeRadius(), prevComp.getAftRadius())) { + // We're going to say it's discontinuous if it is presented to the user as having two different + // string representations. Hopefully there are enough digits in the string that it will + // present as different if the discontinuity is big enough to matter. + if (!UnitGroup.UNITS_LENGTH.getDefaultUnit().toStringUnit(2.0*sym.getForeRadius()).equals(UnitGroup.UNITS_LENGTH.getDefaultUnit().toStringUnit(2.0*prevComp.getAftRadius()))) { + // if ( !MathUtil.equals(sym.getForeRadius(), prevComp.getAftRadius())) { warnings.add( Warning.DIAMETER_DISCONTINUITY, sym + ", " + prevComp); } }