POV-Ray : Newsgroups : povray.advanced-users : Making Patterns with functions : Re: Making Patterns with functions Server Time 9 Sep 2024 13:25:32 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.66c81f9bd81b847917bac71e8ffb8ce3%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.
>

Two older ones for your collection. Thing I found on the web years ago:

---%<------%<---
// Persistence of Vision Ray Tracer Scene Description File
// File: contour.pov
// Vers: 3.5
// Desc: contour plots Idea: Eric Weeks
// http://www.physics.emory.edu/~weeks/ideas/tplot.html
// Date: 2003
// Auth: Ingo Janssen

#version 3.5;

//https://news.povray.org/povray.binaries.scene-files/message/%3CXnsA9D7C1F3776F3seed7%40news.povray.org%3E/#%3CXnsA9D7
C1F3776F3seed7%40news.povray.org%3E

global_settings {assumed_gamma 1.0}
camera {location <0,0,-25> look_at 0}

#declare Contour = function(x,y,z,A,B,C,D,E,F,I,J,K,L) {
E*sin(A*sin(I*x)+ B*cos(J*y))+F*cos(C*cos(K*x)+D*sin(L*y))
}

#declare A =1;
#declare B =1;
#declare C =1;
#declare D =1;
#declare E =1;
#declare F =1;

#declare I =1;
#declare J =1;
#declare K =1;
#declare L =1;

#declare Test  = function(Pf){
(G_smoothstep(Pf,0.1,0.15)-G_smoothstep(Pf,0.15,0.2))
+(G_smoothstep(Pf,0.4,0.6)-G_smoothstep(Pf,0.7,.9))
};

plane {
-z, 0
pigment {
function{Contour(x,y,z,A,B,C,D,E,F,I,J,K,L)}

//function{G_Blinn_Wyvill(Contour(x,y,z,A,B,C,D,E,F,I,J,K,L))}

//function{Test(Contour(x,y,z,A,B,C,D,E,F,I,J,K,L))}

//function{abs(Contour(x,y,z,A,B,C,D,E,F,I,J,K,L))}

//sine_wave
colour_map {
[0 rgb 0]
[1 rgb 1]
}
}
finish {ambient 1}
}
---%<------%<---

---%<------%<---
// POV-Ray 3.7
// Ingo
// found on a Japanese site
// +w1280 +h480 +a0.05 +am3 +ac0.90 +r3
#version 3.7;
global_settings{assumed_gamma 1}
#default{ finish{ambient 0 diffuse 1}}
camera {
orthographic
location <0,0,1>
look_at 0
right x*image_width/image_height
}
#declare PHI = 1.61803399;

// Shuhei Kawachi
// A>0
#declare ShuheiKawachi = function (x,y,z,A,B){
((cos(x)*cos(y)+cos((sqrt(A)*x-y)/B)*
cos((x+sqrt(A)*y)/B)+cos((sqrt(A)*x+y)/B)*
cos((x-sqrt(A)*y)/B)))/3///6 + 0.5
}

plane{ <0,0,-1>, 0
texture {
pigment {
//function{(ShuheiKawachi(x,y,z,pi,1.5))}
function{abs(ShuheiKawachi(x,y,z,pi,1.5))}
sine_wave
scale 0.02
}
finish {ambient 1 diffuse 0}
}
}
---%<------%<---

ingo
```