Velocity Reviews > Is this code correct ?

# Is this code correct ?

Ernie Wright
Guest
Posts: n/a

 03-05-2008
johnnash wrote:

>>There are a number of ways to approach this. One would be to scale the
>>steps in phi by the sine of theta,
>>
>> for ( phi = 0; phi < 360; phi += 5.0 / sin( theta )) ...
>>
>>The poles, where theta = 0 or 180, are treated as a special case, since
>>there's no need to test different increments of phi.

>
> why increment phi in steps of sin(theta) ?? if we do this, then when
> zenith is 90, the rays will far apart whereas near the poles, they
> would be bundled closely and there will be a very thick density.

It depends on how you define your angles. If sine doesn't work, you can
use cosine (which is actually more common).

- Ernie http://home.comcast.net/~erniew

johnnash
Guest
Posts: n/a

 03-05-2008
On Mar 5, 7:09 pm, Ernie Wright <(E-Mail Removed)> wrote:
> johnnash wrote:
> >>There are a number of ways to approach this. One would be to scale the
> >>steps in phi by the sine of theta,

>
> >> for ( phi = 0; phi < 360; phi += 5.0 / sin( theta )) ...

>
> >>The poles, where theta = 0 or 180, are treated as a special case, since
> >>there's no need to test different increments of phi.

>
> > why increment phi in steps of sin(theta) ?? if we do this, then when
> > zenith is 90, the rays will far apart whereas near the poles, they
> > would be bundled closely and there will be a very thick density.

>
> It depends on how you define your angles. If sine doesn't work, you can
> use cosine (which is actually more common).
>
> - Ernie http://home.comcast.net/~erniew

ok i think i understood. may be what you are trying to say is that the
rays tend to bundled along the poles(i.e. theta = 0 and 180) so what
we do is we increment phi by greater values near pole. because when
theta is closer to zero or 180, the sine value will be very low
resulting in a very high value of 5 / sin(theta) ?? but at theta = 90
which represents the equatior, increment is only 5 degree..