POV-Ray : Newsgroups : povray.newusers : Camera algorithm Server Time
4 Nov 2024 19:18:46 EST (-0500)
  Camera algorithm (Message 1 to 4 of 4)  
From: Eddie Lotter
Subject: Camera algorithm
Date: 20 Jun 2003 20:01:13
Message: <3ef3a049$1@news.povray.org>
Is there an algorithm I can use to calculate how far the camera needs to be
from an object so that the object is entirely visible?

I have written a fun utility that reads an image file and converts each
pixel to a sphere, cyclinder or box. I would like to include recommended
camera settings such that all the objects are visible.

Cheers
Eddie


Post a reply to this message

From: Chris Amshey
Subject: Re: Camera algorithm
Date: 22 Jun 2003 05:40:01
Message: <web.3ef578e6bb12258161b99e900@news.povray.org>
Eddie Lotter wrote:
>Is there an algorithm I can use to calculate how far the camera needs to be
>from an object so that the object is entirely visible?
>
>I have written a fun utility that reads an image file and converts each
>pixel to a sphere, cyclinder or box. I would like to include recommended
>camera settings such that all the objects are visible.
>
>Cheers
>Eddie
>

For a camera on the Z-axis, pointing along the Z-axis,
the edge-to-edge view at distance D should be (if my trig skills aren't
totally
miserable):
2 * D * tan(CameraAngle)

You could try 67.380 (degrees) for CameraAngle, but that's an approximation
(from the manual). Remember povray's trig functions take radians; I don't
know what your calculator takes. You'll want to read the camera section of
the manual, especially if you are going to transform your camera in any
way, and it seems to me that the x aperature and the y aperature cannot be
the same in a non-square image (at least not without distortion).

--Chris


Post a reply to this message

From: Chris Amshey
Subject: Re: Camera algorithm
Date: 22 Jun 2003 15:30:01
Message: <web.3ef602fabb12258161b99e900@news.povray.org>
Chris Amshey wrote:

>For a camera on the Z-axis, pointing along the Z-axis,
>the edge-to-edge view at distance D should be (if my trig skills aren't
>totally
>miserable):
>2 * D * tan(CameraAngle)
>
Err, that should be 2*D*tan(CameraAngle/2), actually, so I guess my trig
skills
are totally miserable (but at least I found my own error...)

--Chris


Post a reply to this message

From: POVeddie
Subject: Re: Camera algorithm
Date: 23 Jun 2003 21:20:01
Message: <web.3ef7a61ebb1225819768675c0@news.povray.org>
Chris Amshey wrote:
>Chris Amshey wrote:
>
>>For a camera on the Z-axis, pointing along the Z-axis,
>>the edge-to-edge view at distance D should be (if my trig skills aren't
>>totally
>>miserable):
>>2 * D * tan(CameraAngle)
>>
>Err, that should be 2*D*tan(CameraAngle/2), actually, so I guess my trig
>skills
>are totally miserable (but at least I found my own error...)

Thanks for responding.

The POV Ray 3.1 docs did not give the camera angle.

I had a look at the POV 3.5 docs and found the algorithm:
direction_length=0.5*right_length/tan(angle/2)
which works.

Thanks for pointing me in the right direction.

Cheers
Eddie


Post a reply to this message

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