POV-Ray : Newsgroups : povray.advanced-users : Making Patterns with functions : Re: Making Patterns with functions Server Time
14 Mar 2025 07:12:40 EDT (-0400)
  Re: Making Patterns with functions  
From: Bald Eagle
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

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