POV-Ray : Newsgroups : povray.unofficial.patches : Vortex : Re: Vortex Server Time
2 Sep 2024 02:20:12 EDT (-0400)
  Re: Vortex  
From: Chris Huff
Date: 15 Jul 2000 16:08:16
Message: <chrishuff-0E2F41.15084215072000@news.povray.org>
In article <3970907c@news.povray.org>, "Halbert" <hha### [at] capitalnet> 
wrote:

> Now that I have my previous problem worked out. I thought of 
> something I'd like to try: making an isosurface that would feature a 
> vortex; the kind you see when you pull the stopper out of the tub. 
> This seems like the sort of thing for which an isosurface would be 
> ideally suited. I know there are functions that can form the funnel 
> shape and the spiraling edges, I'm just not sure how to get them 
> together to get the effect I'm looking for. I know one of you guys 
> with the giant brains ( Chris, Warp)  probably has an idea how this 
> might be done.:)

I'm not sure I qualify as having a "giant brain", but this is quite 
simple:
Start with a simple plane: function {y}

Add a function to it which is higher as it is nearer the y axis. There 
are many functions you can use for this, most based on the distance from 
the axis, calculated by sqrt(sqr(x)+sqr(z)).
function {y+(1/(sqr(x)+sqr(z)+0.3))}
The value "0.3" controls the depth of the vortex. If it is 1, the vortex 
will have a depth of 1. If 0, the vortex will go down to infinity.

Next, add some radial waves. This can be done by adding the sine of the 
angle around the y axis, calculated by atan2. The angle is multiplied by 
a certain amount to get multiple waves, and the result of sin(which 
varies from -1 to +1) is multiplied by a "wave amplitude" value:
function {
    y+(1/(sqr(x)+sqr(z)+0.3))
    +sin(atan2(x,z)*7)*0.1
}

Now you need to get the waves to spiral toward the center. I did this by 
adding an amount to the angle depending on the altitude, though you 
could probably also do it based on the distance from the center. Since 
the altitude changes more rapidly toward the center, the waves will 
spiral in faster:
function {
    y+(1/(sqr(x)+sqr(z)+0.3))
    +sin(atan2(x,z)*7 + y*10)*0.025
}
You can either add or subtract the "y*10", depending on which side of 
the equator you live on. :-)
Here is the complete isosurface:
#declare Vortex =
function {
    y+(1/(sqr(x)+sqr(z)+0.3))
    +sin(atan2(x,z)*7 + y*10)*0.025
}
isosurface {
    function {Vortex(x,y,z)}
    threshold 0
    eval
    max_gradient 4
    contained_by {box {<-5,-5,-5>, < 5, 1, 5>}}
    pigment {color rgb < 0.5, 0.85, 1>}
}

-- 
Christopher James Huff - Personal e-mail: chr### [at] maccom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://homepage.mac.com/chrishuff/
TAG Web page: http://tag.povray.org/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.