PDA

View Full Version : view all, things that are out of the viewing volume although



01-16-2001, 03:06 AM
hello,
i want to change my code that all things are drawn the users have selected.
if the user wants to draw an trinagle with coordinates out of the viewing volume,
the volume should change , so that all is visibe.
how can i do that?

coco
01-16-2001, 11:12 AM
You can do something like:
-calc the bounding box that contains all the objects you want to see
-calc teh center of the bounding box
-set as the target of your camera (see gluLookAt) to the center of the bbox.
-calc the angle needed for the FOV so the whole bbox can be viewed (there are various ways of doing this.

The last step (the most complicated) is left to you, do your homework.

Michael Steinberg
01-16-2001, 11:27 AM
Maybe it would be easier to create a bounding sphere and find a fov for it...
Hey coco, what's up?

Oh, and that bounding box fov problem isn't so complicated. You got the center of the box. Then you think of a vector that starts at the viewpoint and points towards the center of the box. Take the 8 vertices of the box and calculate the angles that the vector forms with the vector that goes through the viewpoint and points towards that vertex. Take the largest angle and multiply with 2. That's the fov.