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:
commit
91652e7e4f
@ -4,6 +4,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
|
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
|
||||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||||
|
import net.sf.openrocket.util.MathUtil;
|
||||||
import net.sf.openrocket.util.Coordinate;
|
import net.sf.openrocket.util.Coordinate;
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +63,7 @@ public abstract class AbstractAerodynamicCalculator implements AerodynamicCalcul
|
|||||||
for (int i = 0; i < DIVISIONS; i++) {
|
for (int i = 0; i < DIVISIONS; i++) {
|
||||||
cond.setTheta(2 * Math.PI * i / DIVISIONS);
|
cond.setTheta(2 * Math.PI * i / DIVISIONS);
|
||||||
cp = getCP(configuration, cond, warnings);
|
cp = getCP(configuration, cond, warnings);
|
||||||
if (cp.x < worst.x) {
|
if ((cp.weight > MathUtil.EPSILON) && (cp.x < worst.x)) {
|
||||||
worst = cp;
|
worst = cp;
|
||||||
theta = cond.getTheta();
|
theta = cond.getTheta();
|
||||||
}
|
}
|
||||||
|
@ -592,7 +592,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
|
|
||||||
cg = MassCalculator.calculateLaunch( curConfig).getCM();
|
cg = MassCalculator.calculateLaunch( curConfig).getCM();
|
||||||
|
|
||||||
if (cp.weight > MassCalculator.MIN_MASS){
|
if (cp.weight > MathUtil.EPSILON){
|
||||||
cpx = cp.x;
|
cpx = cp.x;
|
||||||
}else{
|
}else{
|
||||||
cpx = Double.NaN;
|
cpx = Double.NaN;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user