POV-Ray : Newsgroups : povray.newusers : How to use self defined functions as patterns? : How to use self defined functions as patterns? Server Time23 Feb 2024 06:22:14 EST (-0500)
 How to use self defined functions as patterns?
 From: rastertastic Date: 2 Apr 2018 09:05:01 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.5ac22a4ac20ce887122abcd30%40news.povray.org",
"headline": "How to use self defined functions as patterns?",
"dateCreated": "2018-04-02T13:05:01+00:00",
"datePublished": "2018-04-02T13:05:01+00:00",
"author": {
"@type": "Person",
"name": "rastertastic"
}
}
Just started using Povray really don't understand almost anything about it yet,
so maybe I should peruse the manual more but instead I will ask a question with
the risk of not making sense.

Section "3.4.7.1.12 Function Pattern" explains that it's possible to define a
function and use that as a pattern. The manual gives an example:
#declare Foo = function { x + y + z}.

Ok but that function doesn't give values in the range [0,1], for example in the
positive x,y plane Foo just keeps growing.

So if I want to use that function as the pattern type for, say, a color map, can
I specify such ever larger values in the color map.

For example could I use a color map like

color_map {
[0  color Red]
[10  color Green]
[20  color Blue]
[30  color Pink]
}

But rendering the following doesn't produce what I might expect if that is
supposed to work:

plane { <0, 1, 0>, 0
texture {
pigment { function { Foo(x, y, z) }

color_map {
[0  color Red]
[10  color Green]
[20  color Blue]
[30  color Pink]
}
}
}

}

So basically I'm asking clarification on how to use such self-defined functions
like  x + y + z  as patterns with, say, color maps.
```