POV-Ray : Newsgroups : povray.advanced-users : Making Patterns with functions : Re: Making Patterns with functions Server Time 9 Sep 2024 13:36:44 EDT (-0400)
 Re: Making Patterns with functions
 From: ingo Date: 23 Aug 2024 01:40:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.66c820a4d81b847917bac71e8ffb8ce3%40news.povray.org",
"headline": "Re: Making Patterns with functions",
"dateCreated": "2024-08-23T05:40:00+00:00",
"datePublished": "2024-08-23T05:40:00+00:00",
"author": {
"@type": "Person",
"name": "ingo"
}
}
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Over the last 2 days, I've fallen down the mathematical pattern rabbit hole, and
> have been experimenting with all manner of what can be done with a simple
> pigment {function {}}
> statement.

An old one by Alex Kluchikov, not a simple function though:

---%<------%<---

// Alex Kluchikov, 2003
// mailto: klk### [at] ukrnet, akl### [at] mailru
// Feel free to modify/use in any form
include "functions.inc"

camera{
location -5*z
look_at 0
}

// we can get angle from gradient
}

#declare fboz1=function{
pattern{crackle form <1,0,0> scale 1}
}

#declare fboz2=function{
pattern{bumps noise_generator 3 rotate 60 scale 1.2}
}

#declare fboz3=function{
(sin(x+23)*sin(y+2)+sin(x*2.33443+11)*sin(y*2.4332+76)+sin(x*1.133443+32)*sin(y*1.234332+8)+3)*1/6
}

#declare f1=function(x,y,z){
(sin(fboz1(x,y,z)*24*pi
*2*pi
//   +clock*pi*2 // uncomment to animate
)+1)*(1/2)
*(1-fboz1(x,y,z))
}

#declare f2=function(x,y,z){
(sin(fboz2(x,y,z)*24*pi
*2*pi
//   +clock*pi*2 // uncomment to animate
)+1)*(1/2)
}

#declare f3=function(x,y,z){
(sin(fboz3(x,y,z)*24*pi
*2*pi
//   +clock*pi*2 // uncomment to animate
)+1)*(1/2)
}

#declare curles_1=texture{pigment{
function{f1(x,y,z)}
scale .25}
finish{ambient 1}
}

#declare curles_2=texture{pigment{
function{f2(x,y,z)}
color_map{[.45,color rgb 0][.55,color rgb 1]}
scale .25}
finish{ambient 1}
}

#declare curles_3=texture{pigment{
function{f3(x,y,z)}
color_map{[.45,color rgb 0][.55,color rgb 1]}
scale .25}
finish{ambient 1}
}

plane{
-z,1
//use curles_1, curles_2 or curles_2
texture{curles_1}
}
---%<------%<------
ingo
```