In Three.js, I use these formulas to calculate the visible width and height.
var vFOV = camera.fov * Math.PI / 180;
And with this, I calculate the camera scale needed to ensure that the object fits exactly into the visualization area using WIDTH
var zoom = (ObjectHeight/aspect) / (2*Math.tan(vFOV/2)) + ObjectDepth;
How to calculate the scale of the camera needed to ensure that the object fits exactly in the visualization area in height?
Thanks to GuyGood, I found a solution:
var zoom = (ObjectHeight/2) / Math.tan(vFOV/2) - ObjectDepth;
user1732451
source share