Merge pull request #728 from teyrana/fix/723-scaling
[Fixes #723] Fix scaling crashes in some circumstances
This commit is contained in:
commit
908cd3e619
@ -179,8 +179,7 @@ public abstract class RingComponent extends StructuralComponent implements Coaxi
|
||||
if (1 == instanceCount ) {
|
||||
cg = new Coordinate( length/2, 0, 0, instanceMass );
|
||||
}else{
|
||||
Coordinate offsets[] = getInstanceOffsets();
|
||||
for( Coordinate c : offsets) {
|
||||
for( Coordinate c : getInstanceOffsets() ) {
|
||||
c = c.setWeight( instanceMass );
|
||||
cg = cg.average(c);
|
||||
}
|
||||
|
@ -1930,7 +1930,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
||||
|
||||
protected static final double ringMass(double outerRadius, double innerRadius,
|
||||
double length, double density) {
|
||||
return Math.PI * (MathUtil.pow2(outerRadius) - MathUtil.pow2(innerRadius)) *
|
||||
return Math.PI * Math.max(MathUtil.pow2(outerRadius) - MathUtil.pow2(innerRadius),0) *
|
||||
length * density;
|
||||
}
|
||||
|
||||
|
@ -392,7 +392,11 @@ public class ScaleDialog extends JDialog {
|
||||
scale.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
final Rocket rocket = document.getRocket();
|
||||
rocket.enableEvents(false);
|
||||
doScale();
|
||||
rocket.enableEvents(true);
|
||||
|
||||
ScaleDialog.this.document.getRocket().fireComponentChangeEvent( ComponentChangeEvent.AEROMASS_CHANGE);
|
||||
|
||||
|
@ -185,7 +185,7 @@ public abstract class AbstractScaleFigure extends JPanel {
|
||||
* Updates the figure shapes and figure size.
|
||||
*/
|
||||
public void updateFigure() {
|
||||
log.trace(String.format("____ Updating %s to: %g user scale, %g overall scale", this.getClass().getSimpleName(), this.getAbsoluteScale(), this.scale));
|
||||
log.trace(String.format("____ Updating %s to: %g user scale, %g overall scale", this.getClass().getSimpleName(), this.userScale, this.scale));
|
||||
|
||||
updateSubjectDimensions();
|
||||
updateCanvasSize();
|
||||
|
Loading…
x
Reference in New Issue
Block a user