I'm writing a C++ application that outputs POV-Ray scripts of geometric
puzzles. The puzzles come in all concieveble sizes, tiny to humongous.
What I'm trying to do is calculate the location of the camera based on
the size of the object so that the object fills the view. I intend to
leave the camera angle set at 50 all the time.
Does anybody know the equation for this?
Thanks!
Steve
From: Simon Lemieux
Subject: Re: camera distance question
Date: 17 Jun 2000 13:50:39
Message: <394BBAE6.15C88DEF@yahoo.com>
> Does anybody know the equation for this?
D = distance from camera to plane
A = angle of view
S = width of puzzle
D = (S/2) / tan(A);
btw, this is very simple trigonometry...
Hope this solves,
Simon
From: Simon Lemieux
Subject: Re: camera distance question
Date: 17 Jun 2000 15:23:55
Message: <394BD0C3.49B9B651@yahoo.com>
I wrote:
> > > Does anybody know the equation for this?> > D = distance from camera to plane> A = angle of view> S = width of puzzle> > D = (S/2) / tan(A);
Of course, this is assuming your camera is position in the middle of the puzzle
and look a it directly:
Camera
|
V
:
:
:
_______
Wasn't it Steve Strickland who wrote:
>I'm writing a C++ application that outputs POV-Ray scripts of geometric>puzzles. The puzzles come in all concieveble sizes, tiny to humongous.>>What I'm trying to do is calculate the location of the camera based on>the size of the object so that the object fills the view. I intend to>leave the camera angle set at 50 all the time.>>Does anybody know the equation for this?
If you're using an image with the default (4:3) aspect ratio, and call
the height of your object H and the width W.
You need to position the camera H/(2*tan(degrees(50)) away to get it to
just fit vertically.
You need to position the camera (3/4)*W/(2*tan(degrees(50))) to get it
to just fit horizontally.
--
Mike Williams
Gentleman of Leisure