Merge pull request #652 from JoePfeiffer/fix-648

Avoid considering cp with 0 weight when calculating worst-case CP for display in RocketInfo
This commit is contained in:
Daniel Williams 2020-05-05 23:00:39 -04:00 committed by GitHub
commit 91652e7e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import java.util.Map;
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.util.MathUtil;
import net.sf.openrocket.util.Coordinate;
@ -62,7 +63,7 @@ public abstract class AbstractAerodynamicCalculator implements AerodynamicCalcul
for (int i = 0; i < DIVISIONS; i++) {
cond.setTheta(2 * Math.PI * i / DIVISIONS);
cp = getCP(configuration, cond, warnings);
if (cp.x < worst.x) {
if ((cp.weight > MathUtil.EPSILON) && (cp.x < worst.x)) {
worst = cp;
theta = cond.getTheta();
}

View File

@ -592,7 +592,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
cg = MassCalculator.calculateLaunch( curConfig).getCM();
if (cp.weight > MassCalculator.MIN_MASS){
if (cp.weight > MathUtil.EPSILON){
cpx = cp.x;
}else{
cpx = Double.NaN;