POV-Ray : Newsgroups : povray.advanced-users : Making Patterns with functions Server Time
14 Mar 2025 08:55:43 EDT (-0400)
  Making Patterns with functions (Message 47 to 56 of 56)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Bald Eagle
Subject: Re: Making Patterns with functions
Date: 4 Dec 2024 17:30:00
Message: <web.6750d737d81b84791f9dae3025979125@news.povray.org>
Finally had a moment of clarity, and figured out a fish-scale pattern that I
wanted to make.


Post a reply to this message


Attachments:
Download 'mathpatterns1.png' (64 KB)

Preview of image 'mathpatterns1.png'
mathpatterns1.png


 

From: Bald Eagle
Subject: Re: Making Patterns with functions
Date: 4 Dec 2024 17:35:00
Message: <web.6750d8fdd81b84791f9dae3025979125@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Finally had a moment of clarity, and figured out a fish-scale pattern that I
> wanted to make.

And here's a modification to make it less semi-circular.


Post a reply to this message


Attachments:
Download 'mathpatterns1.png' (45 KB)

Preview of image 'mathpatterns1.png'
mathpatterns1.png


 

From: Bald Eagle
Subject: Re: Making Patterns with functions
Date: 31 Dec 2024 12:00:00
Message: <web.677421e6d81b8479d97b426e25979125@news.povray.org>
I was trying to track down something completely unrelated, and came across this
page:

National Curve Bank
A Collection of Famous Plane Curves
created in POVRAY (Persistence Of Vision RAY tracing)

https://old.nationalcurvebank.org/povray/povray.htm


Post a reply to this message

From: Bald Eagle
Subject: Re: Making Patterns with functions
Date: 24 Feb 2025 21:05:00
Message: <web.67bd24c6d81b84791f9dae3025979125@news.povray.org>
Was setting up a basic scene for a completely unrelated pattern, and came up
with this.

Trying to consistently get functions to behave consistently across N=0 is a
giant PITA in POV-Ray, when I don't think it ought to be.


- BW


Post a reply to this message


Attachments:
Download 'newpattern.png' (282 KB)

Preview of image 'newpattern.png'
newpattern.png


 

From: kurtz le pirate
Subject: Re: Making Patterns with functions
Date: 25 Feb 2025 02:34:01
Message: <67bd7269$1@news.povray.org>
On 25/02/2025 03:02, Bald Eagle wrote:
> Was setting up a basic scene for a completely unrelated pattern, and came up
> with this.
> 
> Trying to consistently get functions to behave consistently across N=0 is a
> giant PITA in POV-Ray, when I don't think it ought to be.


Really impressive patterns. What a good job.
Just for a french reader, what PITA meens ?



-- 
kurtz le pirate
compagnie de la banquise


Post a reply to this message

From: Ilya Razmanov
Subject: Re: Making Patterns with functions
Date: 25 Feb 2025 04:54:19
Message: <67bd934b$1@news.povray.org>
On 25.02.2025 10:34, kurtz le pirate wrote:
> Just for a french reader, what PITA meens ?

Pain in the ass.

-- 
Ilyich the Toad
https://dnyarri.github.io/


Post a reply to this message

From: William F Pokorny
Subject: Re: Making Patterns with functions
Date: 25 Feb 2025 05:03:17
Message: <67bd9565$1@news.povray.org>
On 2/24/25 21:02, Bald Eagle wrote:
> Was setting up a basic scene for a completely unrelated pattern, and came up
> with this.

I really like this one!

Bill P.


Post a reply to this message

From: Bald Eagle
Subject: Re: Making Patterns with functions
Date: 25 Feb 2025 06:40:00
Message: <web.67bdaae1d81b84791f9dae3025979125@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
> On 2/24/25 21:02, Bald Eagle wrote:
> > Was setting up a basic scene for a completely unrelated pattern, and came up
> > with this.
>
> I really like this one!
>
> Bill P.

Super.  Maybe you can help me understand why I always have to go through a NEW
form of calisthenics when I cross zero.
(and as you can see, the pattern function is dirt simple)


#version 3.8;
global_settings {assumed_gamma 1}
default {finish {diffuse 1}}
//#include "colors.inc"
#include "functions.inc"
#include "math.inc"
#declare E = 0.000001;

#declare Zoom = 20;
camera {
 orthographic
 location <0, 0, -50>
 right x*image_width/Zoom
 up y*image_height/Zoom
 look_at <0, 0, 0>
 rotate y*0
}

sky_sphere {pigment {rgb 1}}

light_source {<0, 0, -50> rgb 1}

#declare fmod = function (Value, Modulo) {select (Value, 1 - mod (abs (Value),
Modulo), mod (abs (Value), Modulo))}  // this gives a mod function that remains
consistant across the origin


#declare Formula1 = function {(y-sin(x))*(y-cos(x))}  // graphs 2 functions
simultaneously
#declare Formula2 = function {
 select (y,
 select (odd(floor(y/2)), 0, (fmod(y, 2)-sin(x))*(fmod(y, 2)-cos(x)), (fmod(y,
2)+sin(x))*(fmod(y, 2)+cos(x)) ),
 select (odd(floor(y/2)), 0, (fmod(y, 2)-1-sin(x))*(fmod(y, 2)-1-cos(x)),
(fmod(y, 2)-1+sin(x))*(fmod(y, 2)-1+cos(x)) ) // why?
 )
}


// debugging loop
#for (Y, -10, 10)
 #declare Value = odd(floor(Y/2));
 #declare Value2 = fmod(Y,2);
 #debug concat (" Y = ", str(Y, 0, 0),  "     Value = ", str(Value, 0, 0), "
Value2 = ", str(Value, 0, 0), "\n")

#end

#declare Formula = function {Formula2 (x, y, z)}

#declare RawPattern = pigment {function {Formula (x, y, z)}}

#declare Thickness = 0.1;

#declare LinePattern = pigment {function {select (abs (Formula (x, y, z)) -
Thickness, 0, 1)}}    // Once (<=1)
#declare LinePattern2 = pigment {function {select (abs (mod (Formula (x, y, z),
1)) - Thickness, 0, 1)}}




plane {z, 0 texture {pigment {LinePattern} finish {diffuse 1}} translate -z*0.1}


Post a reply to this message

From: William F Pokorny
Subject: Re: Making Patterns with functions
Date: 25 Feb 2025 18:22:52
Message: <67be50cc@news.povray.org>
On 2/25/25 06:34, Bald Eagle wrote:
> Super.  Maybe you can help me understand why I always have to go through a NEW
> form of calisthenics when I cross zero.
> (and as you can see, the pattern function is dirt simple)

If you are working with an equation you wish to use as a pattern, and 
the value of y, say, crossing through 0.0 flips or changes the 
function's behavior, one must deal with it in some way.

In your particular function there is a flip in behavior due internal 
value changes away from zero and another due y changing sign.

Below a yuqk fork scene showing some typical ways for dealing with value 
transitions causing unwanted change with your function based pattern. 
Some work with official POV-Ray releases too. To reproduce your result, 
however, we might need to do something pretty close to what you did! I 
didn't try to exactly match your posted result.

     // Sample scene. 'yuqk y_cross_0.pov +w1024 +h768 +p +mv3.8'
     global_settings { assumed_gamma 1.0 }
     #declare VarOrthoMult =
        20.0/max(image_width/image_height,image_height/image_width);
     #declare Camera01z = camera {
         orthographic
         location <0,0,-2>
         direction z
         right VarOrthoMult*x*max(1,image_width/image_height)
         up VarOrthoMult*y*max(1,image_height/image_width)
     }

     // 'odd()' is one of the fake keywords shipped with official
     // POV-Ray which the yuqk fork removed.
     #include "functions.inc"
     #include "munctions.inc"
     #local Dummy   = M_odd(0.5); // compiling F_odd()
     #local EvenOdd = M_odd(0);   // Later calls run F_odd internally
     #local EvenOdd = F_odd(2);   // = 0
     #local EvenOdd = F_odd(3);   // = 1

     #declare Formula1 = function { (y-sin(x))*(y-cos(x)) }

     // When y moving through zero flips results, it's typical to use
     // pattern value modifiers or similar inbuilt functions.

#if     (1)  // Call as FnY(0,y/2,0)
     #declare FnY = function {
         pattern { gradient y triangle_wave }
     }
#elseif (0)  // Call as FnY(0,y/4,0)
     #declare FnY = function {
         pattern { gradient y function_interval triangle_wave }
     }
#elseif (0)  // Call as FnY(0,y/2,0)
     #declare FnY = function {
         f_triangle_wave(y,0)
     }
#elseif (0)  // Call as FnY(0,y/4,0)
     #declare FnY = function {
         f_triangle_wave(y,1)
     }
#else
     #error "Must pick a definition of function Fny()\n"
#end

     #declare Formula2 = function {
         pattern {
             function { Formula1(x,y,z) }
             triangle_wave
             frequency 4
         }
     }
     #declare Formula3 = function { // Push y positive
         Formula1(x,
             select(
                 F_odd(f_round(y+100+0.5)),
                 0,
                 mod(y+100,1),
                 1-mod(y+100,1)),0)
     }
     #declare FnLine = function {
         select(((Formula2(x,y,z)>-0.1) & (Formula2(x,y,z)<0.1)),
             0, 0, 1)
     }

     plane { -z 0
         pigment {
           //function { Formula1(x,y,z) }
           //function { Formula1(x,FnY(0,y/2,0),z) }
           //function { Formula2(x,FnY(0,y/2,0),z) }
             function { FnLine(  x,FnY(0,y/2,0),z) }
           //function { Formula3(x,           y,z) }
           //raw_wave
             color_map {
                 [-2 rgb <1,0,0>]
                 [-0.01 rgb 0]
                 [+0.01 rgb 0]
                 [+2 rgb <0,1,0>]
             }
         }
         finish { emission 1 }
     }
     camera { Camera01z }

#if (0)
     union {
         sphere {<0, 0,0> , 0.1 }
         sphere {<0,+1,0> , 0.1 }
         sphere {<0,+2,0> , 0.1 }
         sphere {<0,-1,0> , 0.1 }
         sphere {<0,-2,0> , 0.1 }
         pigment { rgb <1,0,0>} finish { emission 1 }
     }
#end


Image attached.

Bill P.


Post a reply to this message


Attachments:
Download 'y_cross0.png' (415 KB)

Preview of image 'y_cross0.png'
y_cross0.png


 

From: Tor Olav Kristensen
Subject: Re: Making Patterns with functions
Date: 1 Mar 2025 10:40:00
Message: <web.67c32942d81b847943a63f5189db30a9@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
>...
> Image attached.

I like this pattern.

It's lovely!

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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