POV-Ray : Newsgroups : povray.general : centering an object for the camera : Re: centering an object for the camera Server Time
2 Nov 2024 09:18:10 EDT (-0400)
  Re: centering an object for the camera  
From: Florian Brucker
Date: 18 Apr 2004 11:31:34
Message: <40829f56@news.povray.org>
> Any suggestions on improving 
> this or know of something that could break its centering ablity?

The only thing I can imagine which would break this method would be bad 
bounding boxes like

sphere {
	0,1
	bounded_by { box { -<100,1,1>,1 } }
}

(not as a result of manual bounding as shown here, but as a result of 
complex CSG). But I don't know a method which would not fail in that 
case (aside from scanning the whole bounding box via trace...). And I 
don't think it'll happen too often.

To make your code just that bit more handy, I'd shorten it into one 
single macro a la:

#macro Scaled_Screen_Object()

which would rescale a given object and pass it to Screen_Object. This 
would make your code more reusable. And of course

    #local objMax = max_extent(container);
    #local objMin = min_extent(container);
    #local objdim = objMax-objMin;

could be shortened to

	#local objdim = max_extent(container) - min_extent(container);

but that's not really necessary.

HTH,
Florian


Post a reply to this message

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