Base 3D view zoom on maximum radius
This commit is contained in:
parent
b0754e3e8a
commit
f77578c5c7
@ -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
|
// Calculate the distance needed to fit the bounds in both the X and Y
|
||||||
// direction
|
// direction
|
||||||
// Add 10% for space around it.
|
// 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)
|
final double dX = (b.span().x * 1.2 / 2.0)
|
||||||
/ Math.tan(Math.toRadians(fovX / 2.0));
|
/ Math.tan(Math.toRadians(fovX / 2.0));
|
||||||
final double dY = ((b.span().y - b.min.y) * 1.2 / 2.0)
|
final double dY = (2*maxR * 1.2 / 2.0)
|
||||||
/ Math.tan(Math.toRadians(fovY / 2.0));
|
/ Math.tan(Math.toRadians(fovY / 2.0));
|
||||||
|
|
||||||
// Move back the greater of the 2 distances
|
// Move back the greater of the 2 distances
|
||||||
|
Loading…
x
Reference in New Issue
Block a user