POV-Ray : Newsgroups : povray.binaries.images : height function maths help Server Time
1 Nov 2024 01:23:46 EDT (-0400)
  height function maths help (Message 1 to 6 of 6)  
From: James Taylor
Subject: height function maths help
Date: 13 May 2002 17:42:41
Message: <3ce03351@news.povray.org>
This one's had me stumped for a few weeks...

I'm trying to get the amplitude of the ripples to decay in both the x and z
directions. In the attached image, I've only achieved the decay in the
x-direction. (and growth in the z?)

It's probably something really simple that I've 'overlooked'...

Here's the code I'm using:
//pov code
#declare k = 2;
#declare h1 = 1/2;
#declare pos1 = <1/8,0,1/8>;

#declare fn_1 =
    function {
        pattern {
            ripples
            frequency 0.75
            scale 0.1
            translate <pos1.x,1-pos1.z,pos1.y>
        }
    }

#declare fn_water = function { h1*( fn_1(x,y,0)*exp(-k*x) ) }

height_field {
    function 400,400 {fn_water(x,y,0)*0.25 + 0.5}
    smooth
    pigment {Red}
    }
//end code

thanks
jim


Post a reply to this message


Attachments:
Download 'hf_new.png' (36 KB)

Preview of image 'hf_new.png'
hf_new.png


 

From: Slime
Subject: Re: height function maths help
Date: 13 May 2002 18:24:47
Message: <3ce03d2f$1@news.povray.org>
Change

#declare fn_water = function { h1*( fn_1(x,y,0)*exp(-k*x) ) }

to

#declare fn_water = function { h1*( fn_1(x,y,0)*exp(-k*sqrt(x^2+y^2)) ) }

And the exponential falloff will be dependant on the overall distance from
the origin, rather than just the distance along the x axis.

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

From: James Taylor
Subject: Re: height function maths help
Date: 14 May 2002 19:07:36
Message: <3ce198b8@news.povray.org>
Thanks, but that doesn't seem to work - it just produces the same result as
before.
Anyway I can see now that the value is dependant on the "overall" distance
so I'll keep experimenting...

Thanks
Jim

"Slime" <slm### [at] slimelandcom> wrote in message
news:3ce03d2f$1@news.povray.org...
> Change
>
> #declare fn_water = function { h1*( fn_1(x,y,0)*exp(-k*x) ) }
>
> to
>
> #declare fn_water = function { h1*( fn_1(x,y,0)*exp(-k*sqrt(x^2+y^2)) ) }
>
> And the exponential falloff will be dependant on the overall distance from
> the origin, rather than just the distance along the x axis.
>
>  - Slime
> [ http://www.slimeland.com/ ]
>
>


Post a reply to this message

From: James Taylor
Subject: Re: height function maths help
Date: 14 May 2002 19:38:40
Message: <3ce1a000@news.povray.org>
"Slime" <slm### [at] slimelandcom> wrote in message
news:3ce03d2f$1@news.povray.org...
> Change
>
> #declare fn_water = function { h1*( fn_1(x,y,0)*exp(-k*x) ) }
>
> to
>
> #declare fn_water = function { h1*( fn_1(x,y,0)*exp(-k*sqrt(x^2+y^2)) ) }
>
> And the exponential falloff will be dependant on the overall distance from
> the origin, rather than just the distance along the x axis.
>
>  - Slime
> [ http://www.slimeland.com/ ]
>
>

figured it...for reasons beyond my comprehension, all y values actually need
to be (1-y), hence the function is:
#declare fn_water = function {h1 * ( fn_1(x,y,0) * exp( -k * sqrt(x^2 +
(1-y)^2) ) ) }

thanks
jim


Post a reply to this message

From: Spock
Subject: Re: height function maths help
Date: 15 May 2002 08:40:27
Message: <3ce2573b@news.povray.org>
Your example looked interesting so I tried it.  I'm learning to hate
functions :-)

Attached is another version of the code that sorta works for me.

Thanks for posting.



"James Taylor" <jim### [at] blueyondercouk> wrote in message
news:3ce1a000@news.povray.org...
>
> "Slime" <slm### [at] slimelandcom> wrote in message
> news:3ce03d2f$1@news.povray.org...
> > Change
> >
> > #declare fn_water = function { h1*( fn_1(x,y,0)*exp(-k*x) ) }
> >
> > to
> >
> > #declare fn_water = function { h1*(
fn_1(x,y,0)*exp(-k*sqrt(x^2+y^2)) ) }
> >
> > And the exponential falloff will be dependant on the overall distance
from
> > the origin, rather than just the distance along the x axis.
> >
> >  - Slime
> > [ http://www.slimeland.com/ ]
> >
> >
>
> figured it...for reasons beyond my comprehension, all y values actually
need
> to be (1-y), hence the function is:
> #declare fn_water = function {h1 * ( fn_1(x,y,0) * exp( -k * sqrt(x^2 +
> (1-y)^2) ) ) }
>
> thanks
> jim
>
>


Post a reply to this message


Attachments:
Download 'ripple2.pov.txt' (1 KB) Download 'ripple2.jpg' (13 KB)

Preview of image 'ripple2.jpg'
ripple2.jpg


 

From: James Taylor
Subject: Re: height function maths help
Date: 15 May 2002 09:42:36
Message: <3ce265cc@news.povray.org>
"Spock" <spo### [at] nospamcom> wrote in message news:3ce2573b@news.povray.org...
> Your example looked interesting so I tried it.  I'm learning to hate
> functions :-)
>
> Attached is another version of the code that sorta works for me.
>
> Thanks for posting.
>

Thanks...you could also try summing together several functions which have
been translated to different positions on the hf to achieve some interesting
interference patterns.

jim


Post a reply to this message

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