[fix] fixed stack overflow in RocketFigure

This commit is contained in:
Daniel_M_Williams 2020-07-03 10:40:35 -04:00
parent 04476ecc98
commit 7c20b64135

View File

@ -418,13 +418,16 @@ public class RocketFigure extends AbstractScaleFigure {
@Override
protected void updateSubjectDimensions() {
// calculate bounds, and store in class variables
final BoundingBox bounds = rocket.getSelectedConfiguration().getBoundingBox();
final double maxR = Math.max(Math.hypot(bounds.min.y, bounds.min.z),
Math.hypot(bounds.max.y, bounds.max.z));
BoundingBox newBounds = rocket.getSelectedConfiguration().getBoundingBox();
if(newBounds.isEmpty())
newBounds = new BoundingBox(Coordinate.ZERO,Coordinate.X_UNIT);
final double maxR = Math.max(Math.hypot(newBounds.min.y, newBounds.min.z),
Math.hypot(newBounds.max.y, newBounds.max.z));
switch (currentViewType) {
case SideView:
subjectBounds_m = new Rectangle2D.Double(bounds.min.x, -maxR, bounds.span().x, 2 * maxR);
subjectBounds_m = new Rectangle2D.Double(newBounds.min.x, -maxR, newBounds.span().x, 2 * maxR);
break;
case BackView:
subjectBounds_m = new Rectangle2D.Double(-maxR, -maxR, 2 * maxR, 2 * maxR);