POV-Ray : Newsgroups : povray.general : trace() question : trace() question Server Time
19 Nov 2024 13:42:57 EST (-0500)
  trace() question  
From: Klaus Lehtonen
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

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