POV-Ray : Newsgroups : povray.unofficial.patches : Making waves - isosurface help : Re: Making waves - isosurface help Server Time
2 Sep 2024 00:15:54 EDT (-0400)
  Re: Making waves - isosurface help  
From: Chris Huff
Date: 20 Jul 2000 09:48:32
Message: <chrishuff-FE1F5E.08490620072000@news.povray.org>
In article <3976be22@news.povray.org>, "Tom Melly" 
<tom### [at] tomandluf9couk> wrote:

> Assuming I didn't want to just use an inbuilt function, etc., what 
> would be the equation to generate a pattern similiar to ripples in an 
> isosurface? (ie. circular waves propagating outwards from a point).

You usually use the cosine of the distance from that point. This gives 
an "onion" type pattern, with the waves emanating in all directions from 
a point. You can also constrain it to a certain plane by removing one 
axis from the calculations, which makes it act like wood. You may want 
this for some uses.

Where <A, B, C> are the coordinates of the "center" of the ring:
"onion-like" function:
function {cos(2*pi*sqrt(sqr(x-A) + sqr(y-B) + sqr(z-C)))}
"wood-like" function(along y-axis):
function {cos(2*pi*sqrt(sqr(x-A) + sqr(z-C)))}


It is also possible to have the "waves" fall off with distance. To do 
this, just multiply the above function by a function which falls off 
with distance, like this:

Where R = radius, F = falloff exponent.
#declare D = function {cos(2*pi*sqrt(sqr(x) + sqr(y) + sqr(z)))}

function {
    D(x-A,0,z-C)*((max(0, R-sqrt(sqr(x-A) + sqr(z-C)))/R)^F)
}


Some additional things: I use sqr(x) instead of x*x or x^2, because it 
may be slightly faster. I also prefer to use cosine instead of sine for 
waves, because it makes a smooth center.
Disclaimer: I haven't actually tested these functions, there may be an 
error or typo somewhere. They should be close, though...

-- 
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.