POV-Ray : Newsgroups : povray.advanced-users : camera distance question Server Time
2 Nov 2024 05:20:35 EDT (-0400)
  camera distance question (Message 1 to 4 of 4)  
From: Steve Strickland
Subject: camera distance question
Date: 17 Jun 2000 07:17:03
Message: <394B5E74.1977F27@puzzlecraft.com>
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


Post a reply to this message

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


Post a reply to this message

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
   :
   :
   :
_______


Post a reply to this message

From: Mike Williams
Subject: Re: camera distance question
Date: 17 Jun 2000 15:36:22
Message: <$5EUzEAdy7S5Ew4D@econym.demon.co.uk>
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


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.