|
![](/i/fill.gif) |
"Kenneth" <kdw### [at] earthlink net> schreef in bericht
news:web.4bbf648570f2d07d65f302820@news.povray.org...
> As has been mentioned:
> * The trace ray 'start' location needs to be somewhere *above* the
> HF...obviously ;-) Personally, I would use <xPos,1000,zPos> to be safe.
> * the 'start' vector is an actual location point; the trace ray direction
> is a
> *directional* vector, NOT the location of a point, and shouldn't normally
> change--at least when tracing a HF.
>
Yes, and when you want to trace, say, a spherical object, like a planet, the
following macro by Tim Attwood comes in handy:
//start code
//--- Tim Attwood's random distribution macro ---
#macro RandOnSurface(Obj, rsd, thresh)
#local mn = min_extent(Obj)-thresh;
#local mx = max_extent(Obj)+thresh;
#local dist = 1000000;
#while (dist>thresh)
#local flag = 0;
#while (flag = 0)
#local rfrom = VRand_In_Box(mn, mx, rsd);
#local rdir = vrotate(<1,1,1>,
<360*rand(rsd),360*rand(rsd),360*rand(rsd)>);
#declare Norm = <0, 0, 0>;
#local hit = trace(Obj, rfrom, rdir, Norm);
#if (vlength(Norm) != 0)
#local flag = 1;
#end
#end
#local dist = vlength( hit - rfrom);
#end
#local result = hit;
(result)
#end
//end code
Thomas
Post a reply to this message
|
![](/i/fill.gif) |