Quote from: Tangled-Universe on November 27, 2007, 12:55:49 PM
That looks very nice
Something I'll probably never be able to, math is too much magic to me.
To get back to your primary question:
Where do you need this kind of function for? (function Atan2(x,y) )
Martin
You can use atan2 in cases where you want control over what happens at a distance from a point
in the landscape, and also depending on the directions.
In this case, I calculates the distance from the center of a unit circle to all points on the the straights lines
which connects the six points of the hexagon.
The inner and the outer distance from the point [2500m, 0m, 2500m] is then multiplied, by the about function.
Then these distances are use to clamp the length function.
Now we have have a function which takes on the value 'inner distance' between 0 and 'inner distance'
and 'outer distance' outside 'outer distance'.
I then convert these values to a range between 0 and 1. This gives an ascending ramp.
Finally I convert this ramp (q) to a bell shaped curve by appying the function
[4q*(1-q)]^2 , which has the values 0 and slope 0 at the endpoints, and the value 1 at the midpoint.
This value is then connected to a displacement shader.