POV-Ray : Newsgroups : povray.binaries.animations : CHROMADEPTH code tests-- animation : Re: CHROMADEPTH code tests-- animation Server Time21 Jun 2021 12:33:09 EDT (-0400)
 Re: CHROMADEPTH code tests-- animation
 From: Bald Eagle Date: 22 Feb 2018 20:30:01 Message:
```"Kenneth" <kdw### [at] gmailcom> wrote:

> One problem with my code is, the  bounding-box coordinates naturally (but
> unfortunately) *change*, if the object is rotated.  I didn't forsee that.
> Another is that the meaning of which coordinate is 'near' or  'far'  can CHANGE,
> depending on where those coordinates are measured from when using min_entent and
> max_extent. My code didn't take that into account. (But I think it's easy to
> fix.)

#declare S = min(L_1,L_2)/max(L_1/L_2);

> But the biggest problem shows up in part 4 of the video. It's not an easy one to
> explain,: basically, as the camera viewing axis approaches a right angle to an
> imaginary 'plane' between the two bounding-box corners, the difference in
> camera-distance to those two points begins dropping to zero- (then 'reverses',
> as to which point was originally 'near' or 'far.') That's a more subtle and
> not-so-easily fixed flaw in my code  :-/    IMO, min_extent/max_extent
> mistakenly begin working in reverse at that point, sensing the now-'far' point
> as  the 'near' one, for example. That doesn't seem right.

Maybe you need to define a _relative_ "min" and "max" based on the distances of
the corners from the camera.   Then I think it should all work out.
I worked out some code to determine what octant I was in, and it was a lot of
lines of code, but not very complex.

Let me know if you need me to dig that out - I don't think you need it though.

> In the video:
The two small spheres show its min_extent/max_extent coordinates--
> yellow for min, black for max-- and apparently they *remain* min and max no
> matter what.

Yes, obviously - that is the expected behaviour.

> Part 2: Same exact test, but now the object is rotating. This shows the changing
> bounding-box size-- and how it affects the spread of the color_map (in my code,
> that is.) So far, it all still works reasonable well.

Yes, very nice - maybe something to code up as a separate project for inclusion
in a distro as a demo scene to show how bounding boxes work.

> Part 3) The most interesting one. The MAIN camera/pigment is now moving around.
> The object has been pre-rotated into a good position to show the effects--as
> they go awry. ;-)

Calculate relative min and max, and I think it'll work out fine.  There might
not even be any weird "jumps" - though I'll bet a graph of distance to min and
max would be interesting.
```