POV-Ray : Newsgroups : povray.newusers : Calculate the camera position automatic : Re: Calculate the camera position automatic Server Time
30 Jul 2024 20:26:52 EDT (-0400)
  Re: Calculate the camera position automatic  
From: Phil Cook
Date: 8 Sep 2003 12:10:16
Message: <opru6u6kgeeybzwd@news.povray.org>
On Mon, 08 Sep 2003 16:24:43 +0200, Florian Brucker <tor### [at] torfboldcom> 
wrote:

> Hi guys!
>
>> You can also have a fixed camera and scale your objects to fit in a 
>> given box, for example box { -1, 1 }, you would have to find their 
>> biggest dimension and then scale that dimension to the box.
> I think that's the better one of the two possibilites. This way he can 
> use different camera-types (orthographic etc.) and parametres (like 
> angle...). Position the camera should be no problem using Trial&Error 
> (TM), but calculating it?
>
> So better go and fit your target in the box :)
>
> HTH,
> Florian

Just out of curiosity, as a newbie would this work?
--
Phil

//POV file starts here
camera{
location <0.5,3,-3>
look_at <0.5,0.5,0.5>
}
//just for this exercise create an object
#declare Object = box{<-5,-10,-3>,<3,7,5> pigment {rgb <1,0,0>} 
finish{ambient 0.6 diffuse 0.4}}

#declare Minimum = min_extent(Object);
#declare Maximum = max_extent(Object);

#declare TotalX = abs(Minimum.x)+ abs(Maximum.x);
#declare TotalY = abs(Minimum.y)+ abs(Maximum.y);
#declare TotalZ = abs(Minimum.z)+ abs(Maximum.z);

#declare FirstTest = (TotalX>TotalY ? TotalX:TotalY);
#declare MaxLength = (TotalZ>FirstTest ? TotalZ:FirstTest);

//for bounding box of 1 unit

object{Object  translate <-Minimum.x,-Minimum.y,-Minimum.z> scale 
(1/MaxLength)}

//show bounds
sphere{<0,0,0>,0.1  pigment {rgbt <0,1,0,0.5>} finish{ambient 0.4 diffuse 
0.6}}
sphere{<1,0,0>,0.1  pigment {rgbt <0,1,0,0.5>} finish{ambient 0.4 diffuse 
0.6}}
sphere{<0,1,0>,0.1  pigment {rgbt <0,1,0,0.5>} finish{ambient 0.4 diffuse 
0.6}}
sphere{<0,0,1>,0.1  pigment {rgbt <0,1,0,0.5>} finish{ambient 0.4 diffuse 
0.6}}
sphere{<1,1,0>,0.1  pigment {rgbt <0,1,0,0.5>} finish{ambient 0.4 diffuse 
0.6}}
sphere{<1,0,1>,0.1  pigment {rgbt <0,1,0,0.5>} finish{ambient 0.4 diffuse 
0.6}}
sphere{<0,1,1>,0.1  pigment {rgbt <0,1,0,0.5>} finish{ambient 0.4 diffuse 
0.6}}
sphere{<1,1,1>,0.1  pigment {rgbt <0,1,0,0.5>} finish{ambient 0.4 diffuse 
0.6}}
//POV file end here
-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


Post a reply to this message

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