|
|
In article <41de5e61$1@news.povray.org>,
"Thorsten Froehlich" <tho### [at] trfde> wrote:
> Depending on the history of the code it is either stupidity or brilliance.
> It could just be the result of many changes that made the function the way
> it is now (stupidity), or the code is trying to play with floating-point
> accuracy in a complex way (brilliance). It is impossible to tell without
> comparing the function and its simplified twin over a significant range of
> input values.
My vote is for a weird hack to get correct results in some old compiler,
and simple neglect accounting for the lack of documentation. (Judging
from the comments in leopard_pattern(), some of the compilers used were
pretty bad.)
The result is a simple sine-wave, either way...I see no way for it to
produce visibly different results, if the math library performs as
advertised.
Really, since it's used only to get a sinusoidal curve, a relatively
inaccurate polynomial approximation or a linearly interpolated look up
table might give good enough results.
Oh, I goofed slightly...the function I gave was what I think the author
was trying to accomplish, but the most simplified version is really:
DBL cycloidal(DBL value)
{
return sin(value*TWO_M_PI);
}
Not really worth having a function devoted to it. Maybe the original was
supposed to fix a sin() function that misbehaved with negative or large
inputs. Maybe fmod() misbehaved too, or the author didn't know about it.
How about the following comment in onion_pattern()?
/* The variable noise is not used as noise in this function */
My question here is pretty obvious. Was there some kind of limit on the
number of identifiers that could be used?
Ouch...just found out that the agate, marble, spiral, and wood patterns
loop through all applied warps (including ordinary transformations) just
to find the last one and use it internally if it is a "classic
turbulence" warp. They always loop through all the transformations, for
every evaluation.
--
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
|
|