![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
If your grab the paper on my page (postscript format) it has the formula.
It's not really a spiral.... it's actually a series of rings but if you
were to animate the process it would look like it was spiraling out.
Part of the 'for' loop is show below. photonSpread is the average
distance between photons at a distance of one unit from the light source
(if I did the math correctly). mintheta is always 0 and maxtheta
depends on the size of the object being shot at.
I have also successfully used this formula to place mirrors on a disco
ball in a POV #while loop.
dtheta = atan(photonOptions.photonSpread);
for(theta=mintheta; theta<maxtheta; theta+=dtheta)
{
photonOptions.hitObject = FALSE;
if (theta<EPSILON)
dphi=2*M_PI;
else
dphi=dtheta/sin(theta);
minphi = -M_PI + dphi*FRAND()*0.5; /* add a bit of jitter */
maxphi = M_PI - dphi/2 + (minphi+M_PI);
for(phi=minphi; phi<maxphi; phi+=dphi)
{
/*
theta is the azimuthal angle - zero means shooting directly at
the object
phi rotates around the point-at axis
*/
}
}
-Nathan
Nieminen Mika wrote:
>
> Not really a patch or even a povray question but...
>
> In the photon patch help we can read that "photons are shot in a spiral
> pattern with uniform angular density".
> What is the formula for this spiral pattern?
>
> ie. suppose that I want to place spheres in a spiral so that the distance
> between the nearest spheres is approximately the same.
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Nieminen Mika
Subject: Re: Spiral pattern with uniform angular density
Date: 22 Jul 1999 03:47:59
Message: <3796ccaf@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Yes, it isn't a spiral, but it works fine. I made this from your code:
#declare Spread = .1;
#declare mintheta = 0;
#declare maxtheta = pi/3;
camera { location <-4,1,-6>*.5 look_at 0 angle 35 }
light_source { <50,100,-200> 1 }
cylinder { 0,z,.02 pigment { rgb x+y } finish { specular .5 } }
cylinder
{ 0,z,.02 rotate x*degrees(maxtheta)
pigment { rgb y+z } finish { specular .5 }
}
#declare dtheta = atan2(Spread,1);
#declare R=seed(0);
#declare theta=mintheta;
#while(theta<maxtheta)
#if(theta=0)
#declare dphi=2*pi;
#else
#declare dphi=dtheta/sin(theta);
#end
#declare minphi= -pi + dphi*rand(R)*.5;
#declare maxphi= pi - dphi/2 + (minphi+pi);
#declare phi=minphi;
#while(phi<maxphi)
sphere
{ z,.05
rotate x*degrees(theta)
rotate z*degrees(phi)
pigment { rgb x } finish { specular .5 }
}
#declare phi=phi+dphi;
#end
#declare theta=theta+dtheta;
#end
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Nieminen Mika
Subject: Re: Spiral pattern with uniform angular density
Date: 22 Jul 1999 03:53:49
Message: <3796ce0d@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Interesting. If you set maxtheta to pi, you get a sphere made of spheres.
That is, points almost equally placed on a spherical surface.
Kewl.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Nieminen Mika wrote:
>
> Interesting. If you set maxtheta to pi, you get a sphere made of spheres.
> That is, points almost equally placed on a spherical surface.
> Kewl.
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Replace the sphere with -
box {-.05,.05 translate z
and use the maxtheta = pi.
It's as kewl !
--
Ken Tyler
mailto://tylereng@pacbell.net
http://home.pacbell.net/tylereng/links.htm
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Nieminen Mika wrote:
>
> Interesting. If you set maxtheta to pi, you get a sphere made of spheres.
> That is, points almost equally placed on a spherical surface.
> Kewl.
almost - but not quite....
The better way is still to use geodesic patterns - see the corresponding
threads in povray.advanced-users, povray.binaries.utililities,
povray.binaries.images
or on my homepage related to the geodesic macro I recently finished:
http://www.geocities.com/SiliconValley/Lakes/5432/povray/geodesic.html
Uwe.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
They are 'on average' equally spaced. The code that shoots photons actually
jitters phi and theta to remove artifacts but that still maintains the
overall density. And the overall density is all that I am worried about
for photons. When you're creating a sphere of spheres, the geodesic
patterns will give you more uniform results.
-Nathan
Uwe Zimmermann wrote:
>
> Nieminen Mika wrote:
> >
> > Interesting. If you set maxtheta to pi, you get a sphere made of spheres.
> > That is, points almost equally placed on a spherical surface.
> > Kewl.
>
> almost - but not quite....
> The better way is still to use geodesic patterns - see the corresponding
> threads in povray.advanced-users, povray.binaries.utililities,
> povray.binaries.images
> or on my homepage related to the geodesic macro I recently finished:
> http://www.geocities.com/SiliconValley/Lakes/5432/povray/geodesic.html
>
> Uwe.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Nieminen Mika wrote:
>
> Yes, it isn't a spiral, but it works fine. I made this from your code:
What is the purpose of using rand in this declare ?
---> #declare minphi= -pi + dphi*rand(R)*.5;
--
Ken Tyler
mailto://tylereng@pacbell.net
http://home.pacbell.net/tylereng/links.htm
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Nieminen Mika
Subject: Re: Spiral pattern with uniform angular density
Date: 23 Jul 1999 06:37:12
Message: <379845d8@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Ken <tyl### [at] pacbell net> wrote:
: What is the purpose of using rand in this declare ?
: ---> #declare minphi= -pi + dphi*rand(R)*.5;
It has no purpose. I didn't know what to put there (1? 0? 0.5? something
else?) so I just replicated it from the C code.
I tried substituting it with '1', but saw no difference.
I think Nathan can answer to this question.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Nieminen Mika wrote:
>
> Ken <tyl### [at] pacbell net> wrote:
> : What is the purpose of using rand in this declare ?
>
> : ---> #declare minphi= -pi + dphi*rand(R)*.5;
>
> It has no purpose. I didn't know what to put there (1? 0? 0.5? something
> else?) so I just replicated it from the C code.
> I tried substituting it with '1', but saw no difference.
> I think Nathan can answer to this question.
After thinking about it it is probably for his jitter function... Nathan ?
--
Ken Tyler
mailto://tylereng@pacbell.net
http://home.pacbell.net/tylereng/links.htm
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Yes, it is for the jitter function. You can start minphi at -pi if you
don't want any jitter.
-Nathan
Ken wrote:
>
> Nieminen Mika wrote:
> >
> > Ken <tyl### [at] pacbell net> wrote:
> > : What is the purpose of using rand in this declare ?
> >
> > : ---> #declare minphi= -pi + dphi*rand(R)*.5;
> >
> > It has no purpose. I didn't know what to put there (1? 0? 0.5? something
> > else?) so I just replicated it from the C code.
> > I tried substituting it with '1', but saw no difference.
> > I think Nathan can answer to this question.
>
> After thinking about it it is probably for his jitter function... Nathan ?
>
> --
> Ken Tyler
>
> mailto://tylereng@pacbell.net
> http://home.pacbell.net/tylereng/links.htm
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |