POV-Ray : Newsgroups : povray.general : centering an object for the camera : Re: centering an object for the camera Server Time
3 Aug 2024 06:15:31 EDT (-0400)
  Re: centering an object for the camera  
From: Eric Medlin
Date: 16 Apr 2004 10:27:11
Message: <eric.medlin-EAF253.10271016042004@news.povray.org>
In article <407efe5f$1@news.povray.org>,
 Florian Brucker <tor### [at] torfboldcom> wrote:

> I'd try it the other way round:
> 
> Set up a scene with some dummy boxes and adjust the camera in a way that 
> it fits your needs. Later replace the dummy boxes by your real objects 
> and scale them to fit the dimensions of the old dummies. This can be 
> done pretty easy using min_extent and max_extent. And it is really 
> easier than calculate new camera parameters.
> 
> HTH,
> Florian
> 

Well I am doing the follow now.
#declare scaledContainer =
object{
   #local objMax = max_extent(container);
   #local objMin = min_extent(container);
   #local objdim = objMax-objMin;
   #if (objDim.x > objDim.y)
      #local objScale = 0.75/objDim.x;
   #else
      #local objScale = 0.75/objDim.y;
   #end
   container
   scale objScale
}
Screen_Object(scaledContainer, <0.5, 0.5>, <0, 0>, true, 1.0)
This seems similar to what you are talking about.  This seems to work 
pretty good on the models I have tried it on.  I thought Screen_Object() 
would do everything for me when I found that macro but it doesn't seem 
to be able to scale the object to make it fit the screen only move it in 
front of the camera, still helpful though.  Any suggestions on improving 
this or know of something that could break its centering ablity?


Post a reply to this message

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