|
|
Hi
I have figured out a little macro to autocenter an object (see below), but I
would like to auto scale that object to fill x% of the image x and y
dimensions.
I know of image_height and _width and I suspect that the calculation I need
has something to do with the camera angle and other camera params, but I am
not sure how to proceed. Also, I would like this to work for a perspective
camera and an orthographic camera.
I would appreciate some help, thanks
#macro AUTOCENTER(SomeObject)
/*
This macro redeclares the input object so as to do the autocentering
on that object .. see help 3.2.2.8.5 Returning Values Via Parameters
This means that a usage like AUTOCENTER(sphere{whatever} is not legal
- you have to pass in an object.
min_extent is not guaranteed to work with all csg objects.
*/
#local jaMin = min_extent ( SomeObject ); // corner 1
#local jaMax = max_extent ( SomeObject ); // corner 2
#local jax =(jaMin.x+jaMax.x)/2;
#local jay =(jaMin.y+jaMax.y)/2;
#local jaz =(jaMin.z+jaMax.z)/2;
#declare SomeObject = object{SomeObject translate <-jax,-jay,-jaz> }
#end // end of macro
Post a reply to this message
|
|