title: Three.js - Orthographic camera
body: <p>I've working on an app which displays some 3D models. We load the models, create the meshes, add them to the scene...standard procedure. After the last mesh is added, we compute the bounding box in order to move the camera and cover all the scene, using the size of the total geometry and the size of the viewport to do the math.</p>
  <pre><code>    if (bounds.bx / bounds.by &lt; camera.aspect) {
          /* Vertical max */
          r = bounds.by / (2 * Math.tan(Math.PI / 8));
      } else {
          /* Horizontal max */
          hFOV = 2 * Math.atan(Math.tan(Math.PI / 8) * camera.aspect);
          r = bounds.bx / (2 * Math.tan((hFOV / 2)));
      }
  </code></pre>
  <p><code>bounds</code> is an object containing the width and height of the bounding box. After this calculation, we move the camera(plus a little ratio, just aesthetics, we want a little room between the geometry and the screen border :) ) and render</p>
  <pre><code>    camera.position.z = r * 1.05;
  </code></pre>
  <p>So far this is implemented and runs ok. This has been done with PerspectiveCamera. Now we want to change that and use OrthographicCamera...turns out to be a mess. Models are too small, we lose the mousewheel zoom from the TrackBall Controls and the algorithm to move the camera is not working anymore. Also I don't understand the parameters of the constructor for the camera...these width and height are for the geometry or the viewport?</p>