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:12 EDT (-0400)
  Re: Haskell vs Java: Building a ray tracer  
From: Francois Labreque
Date: 29 Jun 2012 17:41:36
Message: <4fee2110$1@news.povray.org>

>>>> You already do it for AllIsect(). There's no additional work necessary.
>>>
>>> In Java, calling AllIsect() causes all intersections to be computed. In
>>> Haskell, calling the isect function does /not/ necessarily cause all
>>> intersections to be computed. Only the ones you actually "look at".
>>> That's the point I'm making.
>>
>> As Clipka pointed out, you need to calculate all intersections anyway to
>> find the nearest one.
>
> And as I pointed out, this is not the case for many objects. E.g., a
> sphere has two points of intersection. These are the solutions to a
> quadratic equation. And we all know that the way to solve that is
>
> x = -b +/- Sqrt(b^2 - 4ac) / 2a
>
> To find the "nearest" intersection, you merely pick the "-" rather than
> the "+". Done.

Assuming your sphere is to the "right" of your ray starting point.

>>
>> I was just pulling your leg. You can call your variables Fred, Pebbles
>> and Bambam if you want to. Just don't go about making readability
>> claims, if you do, though. :)
>
> Is it wrong that I actually know who those people are? o_O
>

No.  It's not like the Flintstones is an obscure reference.

-- 
/*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.