|
|
In article <403c951a@news.povray.org>, Wolfgang Wieser <wwi### [at] gmxde>
wrote:
> static DBL radial_pattern (VECTOR EPoint)
> {
> register DBL value;
>
> if ((fabs(EPoint[X])<0.001) && (fabs(EPoint[Z])<0.001))
> { value = 0.25; }
> else
> { value = 0.25 + (atan2(EPoint[X],EPoint[Z]) + M_PI) / TWO_M_PI; }
>
> return(value);
> }
>
> Since atan2() will return values in range -Pi..Pi, the return value
> of the pattern will be in range 0.25 .. 0.25+2*Pi and not in range
> 0..1 as stated in the description of the function.
Note that the code adds pi to atan2() and divides the result by 2*pi
before adding the 0.25. So the range of the function is [0.25, 1.25]...I
don't know why. It gets wrapped to [0, 1] later anyway...maybe it was
done to make the pattern start at +x. Seems unnecessary to me, but
changing it would affect every scene that uses radial. Though you could
make it dependent on version.
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/
Post a reply to this message
|
|