I am looking for a function to ensure that a given box or sphere will be visible in a WebGL canvas, and that it will fit the canvas area. I am using a perspective camera and the camera already points to the middle of the object. I understand that this could be achieved by changing the FOV angle or by moving the camera along the view axis.
Any idea how this could be achieved with ThreeJS ?
This is how I finally implemented it:
An example of this can be seen in https://github.com/OpenWebCAD/node-occ-geomview/blob/master/client/geom_view.js
Here is how I did it { Using TrackBall to Zoomin/out pan etc }