Correctly calculate the maximum height for side view.
When calculating the subject dimensions, use the height as the radius of the circle which intersects all four corners of the BoundingBox in the Y, Z plane for both the rear view and the side view. The rear view was already doing this, but it was non-obvious that the side view should also be using this to calculate the height. It becomes obvious if we think about a winged rocket, i.e. a rocket who's fins in the Z direction are larger than those in the Y direction. In this configuration, a height based off of the fins in along the Y-axis alone will result in a "Fit" scaling which encapuslates the Y-axis fins. However, rotating that rocket will move the larger wings (the Z-axis fins) into the view, but the height will not allow for the wings to draw properly on the screen. Thusly, using the radius from the circle intersecting the bounding box along the Y, Z plane will ensure that the widest point from the body will be able to fit within the side view, regardless of the rotation around the X axis. Signed-off-by: Billy Olsen <billy.olsen@gmail.com>
This commit is contained in:
parent
355bfb61c1
commit
b7345f5c3c
@ -419,13 +419,14 @@ public class RocketFigure extends AbstractScaleFigure {
|
|||||||
protected void updateSubjectDimensions() {
|
protected void updateSubjectDimensions() {
|
||||||
// calculate bounds, and store in class variables
|
// calculate bounds, and store in class variables
|
||||||
final BoundingBox bounds = rocket.getSelectedConfiguration().getBoundingBox();
|
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));
|
||||||
|
|
||||||
switch (currentViewType) {
|
switch (currentViewType) {
|
||||||
case SideView:
|
case SideView:
|
||||||
subjectBounds_m = new Rectangle2D.Double(bounds.min.x, bounds.min.y, bounds.span().x, bounds.span().y);
|
subjectBounds_m = new Rectangle2D.Double(bounds.min.x, -maxR, bounds.span().x, 2 * maxR);
|
||||||
break;
|
break;
|
||||||
case BackView:
|
case BackView:
|
||||||
final double maxR = Math.max(Math.hypot(bounds.min.y, bounds.min.z), Math.hypot(bounds.max.y, bounds.max.z));
|
|
||||||
subjectBounds_m = new Rectangle2D.Double(-maxR, -maxR, 2 * maxR, 2 * maxR);
|
subjectBounds_m = new Rectangle2D.Double(-maxR, -maxR, 2 * maxR, 2 * maxR);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user