|
|
Wasn't it Ken who wrote:
>
>
>Jettero Heller wrote:
>
>> I have a very round object made up of the intersection/union of
>> several toruses and spheres. I wish to find it's maximum
>> diameter in the XZ plane...
>
>max_extent and min_extent should get you close -
>http://www.povray.org/documentation/view/138/
That only gives you the size of the bounding box that POV generates. In
the case of intersections, I believe that POV uses the intersection of
the bounding boxes of the components. This can be a very loose fit in
some circumstances.
For example, consider this:
camera {location <0.45,2,0.45> look_at <0.45,0,0.45>}
background {rgb 1}
light_source {<-30, 100, -30> color rgb 1}
#declare THING =
intersection {
torus {1,0.22 translate <0.9,0,0>}
torus {1,0.22 translate <0,0,0.9>}
torus {1,0.22}
pigment {rgb 1}
}
object {THING}
box {min_extent(THING),max_extent(THING)
pigment {rgbt <1,0,0,0.9>}
}
The pink box shows the min_extent and max_extent size, but the actual
intersection object is very much smaller.
It would be tricky to use trace() on this object unless you already had
a clue about where the tori intersect. If you just trace() rays through
the centre of the bounding box, then most such rays miss the object
completely.
I tried writing some code that did a horizontal scan, using trace to
find the greatest diameter in the x direction, then rotated around the
centre point of that diameter, tracing for the greatest diameter in any
direction. In this particular case, such a scan miserably fails to find
the overall maximum diameter.
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|