POV-Ray : Newsgroups : povray.general : Bell curves : Re: Bell curves Server Time
30 Jul 2024 06:21:52 EDT (-0400)
  Re: Bell curves  
From: SharkD
Date: 1 Sep 2009 18:29:46
Message: <4a9da05a@news.povray.org>
triple_r wrote:
> SharkD <mik### [at] gmailcom> wrote:
>> I would like to create a function for a heightfield that has a nice bell
>> curve shape, but can also be normalized between 0 and 1 along each axis.
>> I've looked at the normal distribution and beta distribution functions,
>> but they can only be normalized along one axis.
> 
> Oh.  It took me a bit to realize what you meant, but why not just
> 
> exp(-x*x-y*y) * (x-1) * (x+1) * (y-1) * (y+1)
> 
> This just clamps the edges to zero while keeping the center at 1.  Still 'looks'
> gaussian.
> 
>  - Ricky
> 
> 
> 

I ended up using this function:

#local BetaA = 3;
#local BetaB = 3;
#local ThingX = ((BetaA - 1) / (BetaB - 1 + BetaA - 1) - 1/2) * 2;
#local ThingY = pow(ThingX/2 + 1/2, BetaA - 1) * pow(1 - (ThingX/2 + 
1/2), BetaB - 1);

function {pow(f_r(x,y,z)/2 + 1/2, BetaA - 1) * pow(1 - (f_r(x,y,z)/2 + 
1/2), BetaB - 1) / ThingY}

It's basically the same as the beta distribution function, minus the 
exponent (or beta function). I realized it was not necessary.

-Mike


Post a reply to this message

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