When determining worst-case CP, only consider cases where the CP's weight is non-zero

This commit is contained in:
JoePfeiffer 2020-05-05 10:46:31 -06:00
parent 51b2f7a03f
commit 2d9239fe5b

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();
}