[fix] 2D Rocket Figure will now display off-axis CoM and CoP values

This commit is contained in:
Daniel_M_Williams 2020-05-06 15:26:06 -04:00
parent 91652e7e4f
commit 2a524c2855

View File

@ -554,7 +554,10 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
private void updateExtras() { private void updateExtras() {
Coordinate cp, cg; Coordinate cp, cg;
double cpx, cgx; double cgx = Double.NaN;
double cgy = Double.NaN;
double cpx = Double.NaN;
double cpy = Double.NaN;
FlightConfiguration curConfig = document.getSelectedConfiguration(); FlightConfiguration curConfig = document.getSelectedConfiguration();
// TODO: MEDIUM: User-definable conditions // TODO: MEDIUM: User-definable conditions
@ -594,14 +597,12 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
if (cp.weight > MathUtil.EPSILON){ if (cp.weight > MathUtil.EPSILON){
cpx = cp.x; cpx = cp.x;
}else{ cpy = Math.hypot(cp.y, cp.z);
cpx = Double.NaN;
} }
if (cg.weight > MassCalculator.MIN_MASS){ if (cg.weight > MassCalculator.MIN_MASS){
cgx = cg.x; cgx = cg.x;
}else{ cgy = Math.hypot(cg.y, cg.z);
cgx = Double.NaN;
} }
figure3d.setCG(cg); figure3d.setCG(cg);
@ -630,9 +631,8 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
if (figure.getType() == RocketPanel.VIEW_TYPE.SideView && length > 0) { if (figure.getType() == RocketPanel.VIEW_TYPE.SideView && length > 0) {
// TODO: LOW: Y-coordinate and rotation extraCP.setPosition(cpx, cpy);
extraCP.setPosition(cpx, 0); extraCG.setPosition(cgx, cgy);
extraCG.setPosition(cgx, 0);
} else { } else {