|
In lugnet.cad.dev, Orion Pobursky writes:
> Maybe someone can point me in the right direction...
>
> I have an object with a known bounding box, how do I calculate the position
> of the camera so that the whole object is shown on a screen of known
> dimentions? In other words, how to I determine the amount I should the
> camera away from the object so that the entire object is shown in the viewport?
Hi Orion,
The law of similar triangles comes to mind...... not that I consider
myself much of a mathemetician.
Pick an aribitrary camera distance greater than zero and calculate the
size of the bounding box projected into a 2D plane (the viewport of
arbitrary size). Figure out which dimension (X or Y) is furthest from the
dimensions of the viewport. Determine the scaling factor needed to make the
most out of whack dimension equal to the dimension of the viewport.
Multiply the camera radius by the scaling factor.
Mine is a hypothesis. Lars really knows how to do it ;-)
Kevin
>
> -Orion
|
|
Message is in Reply To:
| | Camera Positioning
|
| Maybe someone can point me in the right direction... I have an object with a known bounding box, how do I calculate the position of the camera so that the whole object is shown on a screen of known dimentions? In other words, how to I determine the (...) (22 years ago, 25-Mar-03, to lugnet.cad.dev, lugnet.cad.ray)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|