POV-Ray : Newsgroups : povray.beta-test : Strange results from min_extent and max_extent : Re: Strange results from min_extent and max_extent Server Time
23 Apr 2024 22:54:25 EDT (-0400)
  Re: Strange results from min_extent and max_extent  
From: clipka
Date: 17 Feb 2019 15:14:05
Message: <5c69c08d$1@news.povray.org>
Am 17.02.2019 um 09:50 schrieb Thomas de Groot:
> Using povray-3.8.0-alpha.10013324-av645-Win64
> 
> When using:
> 
> #local Object=
> difference {
>    sphere {<0,0,0>, 6.0}
>    disc {<0,0,0>, y, 6.1}
> }
> //----------------------------------------
> #declare Min = min_extent(Object);
> #declare Max = max_extent(Object);
> #debug concat("\n  min_extent Object: <",vstr(3, Min, ", ", 0,3),">\n")
> #debug concat("  max_extent Object: <",vstr(3, Max, ", ", 0,3),">\n\n")
> //----------------------------------------
> 
> My intuition tells me that the results should be:
> Min = <-6.000, 0.000, -6.000>
> Max = < 6.000, 6.000,  6.000>
> 
> However, I get the following:
> Min = <-6.000, -6.000, -6.000>
> Max = < 6.000,  6.000,  6.000>
> 
> I never noticed this before while I extensively use these features. Is 
> this a bug or am I stupid?

The latter. (Hey, you asked a straightforward question, so you deserve a 
straightforward answer :))

You shouldn't be using `disc` to cut away a plane. The fact that it 
works is nothing more than a quirk, and the person who made it so should 
be tarred and feathered. Use straightforward `plane` instead.


A couple of things to note in this context:

- The `min_extent` and `max_extent` functions are only guaranteed to 
provide _bounds_ for the extent of the object. The actual extent may be 
smaller. Considerably smaller in some cases.

- As a matter of fact `min_extent` and `max_extent` give you the extent 
of the object's _bounding box_.

- `difference` is actually implemented as an intersection, with all 
children except the first being inverted.

- The bounding box of an intersection is computed as the intersection of 
the children's bounding boxes.

- Inverted objects are typically infinite

- Infinite objects have an infinite bounding box.

- The plane gets special treatment in the computation of intersection 
bounding boxes because it is too useful as a cutting tool.


Post a reply to this message

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