POV-Ray : Newsgroups : povray.general : Formula please Server Time
5 Aug 2024 12:21:48 EDT (-0400)
  Formula please (Message 1 to 7 of 7)  
From: Mick Hazelgrove
Subject: Formula please
Date: 1 Oct 2002 12:30:37
Message: <3d99cdad@news.povray.org>
Can anyone give me a formula for an isosurface consisting of a y plane with
ripples emmanating from a central point with the ripples growing wider apart
as they get further from the center. I spent some hours on it but its beyond
my math I'm afraid :-(

Mick


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Formula please
Date: 1 Oct 2002 12:51:46
Message: <3d99d2a2$1@news.povray.org>
#version 3.5;
#include "colors.inc"
#include "functions.inc"

camera {
 location < 0,20,45>
 look_at < 0, 0, 0>
}

light_source {<50,5,0> color White}
light_source {<-50, 150,-75> color White*0.35}

background { color <0.094,0.184,0.337> }

#declare arrr=function{pow((pow(x,2)+pow(z,2)),0.25)}

isosurface {
 function {y- sin(0.1+100/arrr(x,y,z))}
        threshold 0
 max_gradient 1.05
 contained_by{ box {-100,100}}
        accuracy      0.0001
 pigment{rgb <.6,.6,.2>}
 finish{ambient 0.3}
}
>
>


Post a reply to this message

From: Tom Melly
Subject: Re: Formula please
Date: 1 Oct 2002 12:55:40
Message: <3d99d38c$1@news.povray.org>
"Greg M. Johnson" <gregj:-)565### [at] aolcom> wrote in message
news:3d99d2a2$1@news.povray.org...

<snip>

Hmm, I got as far as:

#declare Rip_func = function(x,y,z){
  y - ( sin( pow(pow(x,2) + pow(z,2),0.5) ) )

}

#declare Rip_test =
isosurface {
  function { Rip_func(x*5, y, z*5) - 1 }
  contained_by {sphere{0,5}}
  accuracy 0.001
  max_gradient 10
  pigment{Red}
}

object{Rip_test}

... getting there.


Post a reply to this message

From: Mick Hazelgrove
Subject: Re: Formula please
Date: 1 Oct 2002 13:21:31
Message: <3d99d99b@news.povray.org>
Thanks fellas

Most grateful

Mick

"Mick Hazelgrove" <mic### [at] mhazelgrovefsnetcouk> wrote in message
news:3d99cdad@news.povray.org...
> Can anyone give me a formula for an isosurface consisting of a y plane
with
> ripples emmanating from a central point with the ripples growing wider
apart
> as they get further from the center. I spent some hours on it but its
beyond
> my math I'm afraid :-(
>
> Mick
>
>


Post a reply to this message

From: Warp
Subject: Re: Formula please
Date: 1 Oct 2002 13:28:22
Message: <3d99db36@news.povray.org>
Perhaps something like this:

#declare Ripples =
  function { y-sin(pow(x*x+z*z,1/3)+pi/4) }

camera { location <0,15,-20> look_at 0 angle 35 }
light_source { <100,200,-50>, 1 }

isosurface
{ function { Ripples(x*10,y,z*10) }
  contained_by { box { -<15,1,15>, <15,1,15> } }
  max_gradient 3.4
  scale <1,.5,1>
  pigment { rgb z }
  finish { specular .5 }
}

  The key value which controls the rate of change of the ripples is the
1/3 in the exponent of the function. 1/2 (ie. square root) will give ripples
at equal distances. Values larger than 1/2 will make the ripples to increase
frequency farther away from the origin, while values smaller than 1/2
(eg. the used 1/3) will decrease the frequency.
  (Note that changing the exponent will also change the overall frequency,
so the factors in the function call (inside the isosurface) will probably
need to be adjusted accordingly.)


-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Mick Hazelgrove
Subject: Re: Formula please
Date: 1 Oct 2002 14:11:34
Message: <3d99e556@news.povray.org>
Thanks Warp thats the one I needed

Thanks again

Mick

"Warp" <war### [at] tagpovrayorg> wrote in message
news:3d99db36@news.povray.org...
>   Perhaps something like this:
>
> #declare Ripples =
>   function { y-sin(pow(x*x+z*z,1/3)+pi/4) }
>
> camera { location <0,15,-20> look_at 0 angle 35 }
> light_source { <100,200,-50>, 1 }
>
> isosurface
> { function { Ripples(x*10,y,z*10) }
>   contained_by { box { -<15,1,15>, <15,1,15> } }
>   max_gradient 3.4
>   scale <1,.5,1>
>   pigment { rgb z }
>   finish { specular .5 }
> }
>
>   The key value which controls the rate of change of the ripples is the
> 1/3 in the exponent of the function. 1/2 (ie. square root) will give
ripples
> at equal distances. Values larger than 1/2 will make the ripples to
increase
> frequency farther away from the origin, while values smaller than 1/2
> (eg. the used 1/3) will decrease the frequency.
>   (Note that changing the exponent will also change the overall frequency,
> so the factors in the function call (inside the isosurface) will probably
> need to be adjusted accordingly.)
>
>
> --
> #macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb
x]
> [1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
> -1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// -
Warp -


Post a reply to this message

From: Christopher James Huff
Subject: Re: Formula please
Date: 1 Oct 2002 15:59:05
Message: <chrishuff-171B6F.15562501102002@netplex.aussie.org>
In article <3d99cdad@news.povray.org>,
 "Mick Hazelgrove" <mic### [at] mhazelgrovefsnetcouk> wrote:

> Can anyone give me a formula for an isosurface consisting of a y plane with
> ripples emmanating from a central point with the ripples growing wider apart
> as they get further from the center. I spent some hours on it but its beyond
> my math I'm afraid :-(

Well, distance from the y axis is sqrt(x*x + z*z). Since you want them 
wider apart at a distance, you could use the inverse or inverse square 
of this...that is simple to do, just remove the sqrt() and divide 1 by 
this value. Use sin() or cos() to get waves, and multiply by some value 
to adjust the number of waves. Now you have something like:

#declare Ripple = function (x, y, z, n) {cos(n/(x*x + z*z))}

The n/r or n/(r^2) starts out at infinity at r = 0, and gets closer and 
closer to 0 as r goes towards infinity, passing through 1 when r == n. 
The infinity will cause problems, you could make sure it never gets 
above n by offsetting r by 1:

#declare Ripple = function (x, y, z, n) {cos(n/(x*x + z*z + 1))}

The n value adjusts the number of ripples, you could also lower the 
offset amount to get more ripples. Multiply the result to adjust the 
height of the ripples, and add or subtract from a plane. For multiple 
ripples, call Ripple() multiple times, adding/subtracting values to the 
xyz coordinates to move the centers around.

isosurface {
    function {y - Ripple(x, y, z, 7)*0.2}
    threshold 0
    ...
}

This is all untested code, but it should get you started. Another thing 
you should probably do is make the ripple size decrease with distance, 
you should be able to figure out how to do that from this code.

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

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