title: Camera distance for 3D object
body: <p>Assuming I have a 3D object. I have no detailed information about the form of the object, the only information I have is the ranges of the 3 axis coordinates (the min/max x-coordinate etc.).</p>
  
  <p>Given a camera "direction" (so basically from which angle does the camera look at the object) how can I calculate how far away the camera has to be to allow viewing the whole object on a screen of a certain size.</p>
  
  <p>So basically I have the following inputs:</p>
  
  <ul>
  <li>Object boundaries</li>
  <li>Camera "direction"</li>
  <li>Screen size</li>
  </ul>
  
  <p>And want to calculate the camera distance.</p>
  
  <p>How can I solve this?</p>
  
  <p>I found a lot of information about how to project a 3D point onto a 2D plane when knowing the camera position in 3D-coordinates, but I failed in adapting the formulas in a way to match my inputs/outputs.</p>
  
  <p>Example inputs would be:</p>
  
  <ul>
  <li>x: (0-100), y: (0-100), z: (0-100)</li>
  <li>The camera looks at the object as if it was rotated 45° around the Z axis and 45° around the X axis</li>
  <li>The screen is 600x600 in size</li>
  </ul>
  
  <p>Thanks in advance!</p>