POV-Ray : Newsgroups : povray.off-topic : Haskell vs Java: Building a ray tracer : Re: Haskell vs Java: Building a ray tracer Server Time
29 Jul 2024 08:10:27 EDT (-0400)
  Re: Haskell vs Java: Building a ray tracer  
From: Francois Labreque
Date: 3 Jul 2012 14:24:03
Message: <4ff338c3$1@news.povray.org>

> On 03/07/2012 02:35 PM, Francois Labreque wrote:

>>>> Assuming your sphere is to the "right" of your ray starting point.
>>>
>>> No assumption.
>>>
>>> The result of this equation is the distance along the ray that you need
>>> to travel to get to the intersection. Therefore, the lowest solution is
>>> guaranteed to be the one you want. (Unless the camera is /inside/ the
>>> sphere, which won't work for several other reasons besides this one.)
>>
>> No assumption, except for this one, that one, and these other ones,
>> too...
>>
>> :P
>
> No assumption, assuming the camera isn't inside a solid object.

Huh...

Ok, and even though you're building this just for your own amusement, is 
this limitation of the software fully documented?  Will you remember it 
when you get to version 13 and you decide to add CSG support or POV SDL 
parsing?  What if you mess up a rotation or translation and your camera 
inadvertantly ends up inside an object?

Call me paranoid, but I'd prefer to expect the unexpected and program 
for it right away, instead of simply assuming it won't ever happen.  At 
the very least, you should test for it and bail out gracefully rather 
than invoke undefined behaviour.

>
> If the camera /is/ inside a solid object, you need to adjust several
> things beyond just the ray intersection tests.

Agreed.  But that does not negate our original point that in order to 
find the nearest intersection, you need to find them all.
-- 
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/*    flabreque    */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/*        @        */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/*   gmail.com     */}camera{orthographic location<6,1.25,-6>look_at a }


Post a reply to this message

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