POV-Ray : Newsgroups : povray.general : trace() question Server Time
19 Nov 2024 11:38:03 EST (-0500)
  trace() question (Message 1 to 3 of 3)  
From: Klaus Lehtonen
Subject: trace() question
Date: 20 Feb 2002 09:40:10
Message: <3c73b54a@news.povray.org>
Hi.
I managed to get trace() to work, but I found something that I could find in
the help files. I made the following scene.

camera {
   location <2,2,-2>
   look_at <0,0,0>
   }
light_source { <100,100,-100> color rgb 1 }
#local thing = cone { <0,1,0>,0,<0,0,0>,1 }
#local norm = <0,0,0>;
#local r = seed(0);
object { thing pigment { rgbt <1,0,0,0.7> } }
plane { <0,1,0>,0 pigment { rgb <0,1,0> } }
#local a = 0;
#while (a<500)
   #local placex = 1-(2*rand(r));
   #local placez = 1-(2*rand(r));
   #local start = <placex,10,placez>;
   #local ending = <placex,-100,placez>;
   #local place = trace(thing,start,ending,norm);
   #if (vlength(norm)!=0)
      sphere { place,0.05 pigment { rgbt <1,1,1,0.5> } }
   #else
      sphere { <placex,0,placez>,0.05 pigment { rgb <0,0,1> } }
   #end
   #local a = a + 1;
#end

It renders as expected: white spheres are on the cone and those that don't
hit the cone are blue and on the plane.

If I chance the line 15 from #local start = <placex,10,placez>; to #local
start = <placex,100,placez>; the amount of white spheres decreace and a lot
of blue spheres appear inside the cone. To my sense the scene should be
exactly same as before. Is there some reason the program works this way or
am I missing something here?


Post a reply to this message

From:
Subject: Re: trace() question
Date: 20 Feb 2002 10:03:29
Message: <khe77ustr9onfenig3c4juclkeavq6m8qr@4ax.com>
On Wed, 20 Feb 2002 16:39:42 +0200, "Klaus Lehtonen" <leh### [at] hotmailcom>
wrote:
>   #local ending = <placex,-100,placez>;
>   #local place = trace(thing,start,ending,norm);

third parameter of trace is value of direction vector,
not ending point of direction vector

I suppose You want:
#local ending = <0,-1,0>;

change to this and check again your script

ABX


Post a reply to this message

From: Klaus Lehtonen
Subject: Re: trace() question
Date: 20 Feb 2002 10:09:45
Message: <3c73bc39@news.povray.org>
Thanks! Now it makes sense. I had totally missed that bit.



> On Wed, 20 Feb 2002 16:39:42 +0200, "Klaus Lehtonen"
<leh### [at] hotmailcom>
> wrote:
> >   #local ending = <placex,-100,placez>;
> >   #local place = trace(thing,start,ending,norm);
>
> third parameter of trace is value of direction vector,
> not ending point of direction vector
>
> I suppose You want:
> #local ending = <0,-1,0>;
>
> change to this and check again your script
>
> ABX


Post a reply to this message

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