|
|
In article <MPG.14a492244e6b256098985c@news.povray.org>,
jam### [at] dh70qdu-netcom (Jamie Davison) wrote:
> I looked at the source, and whimpered...
>
> Too much mathematics <shudder>
It's not that hard...it's a pretty simple function, made of even simpler
pieces.
The full equation is:
1/(sqr(x)+sqr(z)+0.3) + sin(atan2(x,z)*7 + y*10)*0.025 = 0
The 1/(sqr(x)+sqr(z)+0.3) part is what gives it it's shape...it is based
on 1/R where R is the distance from the y axis. The equation for R is
sqrt(sqr(x) + sqr(z)), so that is just 1/(sqr(R)+0.3). The "+ 0.3" part
keeps it from going to 1/0 at the y axis, and limits the depth of the
vortex (Since the square of distance from the axis can't be negative, it
can't go further than 1/0.3. I just got this value by trial and error.).
You can graph the function 1/(sqr(x)+0.3) in any graphing program to get
a cross-section of the basic vortex.
The second half adds the ripples:
sin(atan2(x,z)*7 + y*10)*0.025
The value of atan2(x,z) is simply the angle around the y axis measured
in radians, similar to the "radial" pattern. I multiplied that by 7 to
get more ripples, giving it a higher frequency, and then added an amount
depending on height to make it spiral in as the sides of the vortex got
steeper (basically rotating the density field by a height-dependant
amount. Since the height changes more rapidly in the "walls" of the
vortex, it will spiral in tighter.).
I took the sin() of this value to get the waves and added the result to
the basic vortex shape...the sin() function produces a nice, smooth
periodic waveform which makes it useful for this sort of thing. The
*0.025 part scales the size of the ripples down, so they barely make an
impression on the surface.
So most of it was just piecing together simple little expressions...
--
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
<><
Post a reply to this message
|
|