|
|
Alain <kua### [at] videotronca> wrote:
>
> The faces of the bounding box are always parallel to the reference planes.
Yes, that's the way I understand it as well.
> The same thing apply when you rotate your object : The bounding box
> never get rotated in any way and need to expend to completely contain
> the object.
Yes again. (Although, years ago, I thought the bounding-box got rotated along
with the object-- before I understood the true nature of the box faces being
always parallel to the reference planes.)
> So,
> cylinder{50*y, -50*y, 1}
> have a tight bounding box, while
> cylinder{50, -50, 1}
> only touch the bounding box at 6 points (one on each faces near corners)
> and is aligned along one of it's diagonals, leaving the bounding box
> almost empty.
*Ideally*, that is what I would expect; but a rotated object shows that few if
any of the bounding-box faces actually touch the object. There is excess space,
in other words. As Clipka says, the bounding-box cross section could actually
end up being twice the size of the object itself (sorry if I'm not paraphrasing
his words exactly.)
Here's a "bounding-box tester" scene, to show what I mean, using a rotated
stubby cylinder. (Another object could be substituted in the code, just so its
own 'cross section' is approximately 1 unit in size.)
-------
#version 3.7; // or 3.71 or 3.8
global_settings {assumed_gamma 1.0}
#declare CAMERA_POSITION = 1; // 1 -- front
// 2 -- right side
// 3-- top
#declare OBJECT_ROTATION = 35; // 0.0, or some other single value,
// for simplicity
//----------
#switch(CAMERA_POSITION)
#case(1)
// FRONT view ((i.e., looking at X/Y plane)
camera {
orthographic
location <9.2, 9.2, 2>
look_at <9.201, 9.201, 9.200>
right x*image_width/image_height // aspect
angle 15
}
#break
#case(2)
// SIDE view (i.e., looking at Y/Z plane)
camera {
orthographic
location <16.2, 9.2, 9.2>
look_at <9.201, 9.201, 9.201>
right x*image_width/image_height // aspect
angle 15
}
#break
#case(3)
// TOP view ((i.e., looking at X/Z plane)
camera {
orthographic
location <9.2, 18.2, 9.2>
look_at <9.2, 9.2, 9.201>
right x*image_width/image_height // aspect
angle 15
}
#break
#else
#end
light_source {
0*x
color rgb .7
translate <200, 400, -200>
}
light_source {
0*x
color rgb .3
translate <-200, 100, -200>
}
background{rgb .1}
#declare OBJ =
cylinder{0,.15*y,.5
no_shadow
texture{
pigment{rgb .8}
finish{ambient .1 diffuse .9}
}
scale 1 // or whatever
rotate OBJECT_ROTATION
translate 9.2 // also used below
}
OBJ
// the bounding box (its visible substitute)
box{min_extent(OBJ),max_extent(OBJ)
no_shadow
texture{
pigment{rgbt <.3,.5,1,.7>}
finish{ambient .3 diffuse .7}
}
}
sphere{min_extent(OBJ),.03} // BLACK-- MIN_EXTENT corner
sphere{max_extent(OBJ),.03 pigment {rgb <0,4,0>}} // GREEN-- MAX_EXTENT corner
#declare CENTER_OF_BOUNDING_BOX =
...5*(max_extent(OBJ)-min_extent(OBJ)) + min_extent(OBJ);
// RED sphere
sphere{CENTER_OF_BOUNDING_BOX, .15
pigment{rgb <2,0,0>}
}
#debug concat("\n","CENTER OF BOUNDING BOX at <",
vstr(3,CENTER_OF_BOUNDING_BOX,",",1,3),">","\n\n")
Post a reply to this message
|
|