Merge pull request #1415 from SiboVG/issue-1351

[Fixes #1351] Include ymin in 3D figure bounding box calculation
This commit is contained in:
SiboVG 2022-06-09 21:42:41 +02:00 committed by GitHub
commit 0c9cb22660
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -515,9 +515,11 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
// Calculate the distance needed to fit the bounds in both the X and Y
// direction
// Add 10% for space around it.
final double maxR = Math.max( Math.hypot(b.min.y, b.min.z),
Math.hypot(b.max.y, b.max.z));
final double dX = (b.span().x * 1.2 / 2.0)
/ Math.tan(Math.toRadians(fovX / 2.0));
final double dY = (b.span().y * 1.2 / 2.0)
final double dY = (2*maxR * 1.2 / 2.0)
/ Math.tan(Math.toRadians(fovY / 2.0));
// Move back the greater of the 2 distances