#version 3.8; global_settings {assumed_gamma 1} #declare E = 0.0001; //#include "ArrayMacros.inc" #include "functions.inc" #include "math.inc" //#include "rand.inc" #declare Zoom = 10; camera { orthographic location <0, 0, -50> right x*image_width/Zoom up y*image_height/Zoom look_at <0, 0, 0> rotate y*0 } camera { location <0, 0, -200> right x*image_width/image_height up y look_at <0, 0, 0> } light_source {<50, 50, -50> rgb 1} light_source {<-50, 50, -50> rgb 1} sky_sphere {pigment {rgb 1}} #declare Distance = function (X, Y, Z) {sqrt (X*X+Y*Y+Z*Z)} #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 Sqr = function (N) {N*N} #declare ArmSpacing = 0.004; #declare LineThickness = 0.0004; #declare Aspect = image_width/image_height; #declare U = function {x/image_width*Aspect} #declare V = function {y/image_height} #declare Angle = function {atan2 (V(x,y,z), U(x,y,z))} #declare l = function {Distance (U(x,y,z), V(x,y,z), 0)} #declare Offset = function {l(x,y,z) + ArmSpacing * (Angle(x,y,z)/(tau))} #declare circles = function {fmod (Offset(x,y,z), ArmSpacing)} #declare FracTurn = function {abs (l(x,y,z)/ArmSpacing - Angle(x,y,z)/(tau))} #declare ArcLength = function (b, _Theta) {b/2 * (_Theta * sqrt (1 + _Theta*_Theta) + ln (_Theta + sqrt (1 + _Theta*_Theta)))} //#declare f_Spiral = function {select (circles (x,y,z) - LineThickness, 0, 1)} //#declare f_Spiral = function {select (circles (x,y,z) - LineThickness, 0, 0.0+FracTurn(x, y, z))} //#declare f_Spiral = function {select (circles (x,y,z) - LineThickness, (ArcLength (l(x,y,z) + ArmSpacing, Angle (x, y, z)-pi)), 0 )} //#declare f_Spiral = function {select (circles (x,y,z) - LineThickness, ArcLength ((l(x,y,z)/ArmSpacing+Angle (x, y, z))/10, Angle (x, y, z)-pi), 0 )} #declare f_Spiral = function {select (circles (x,y,z) - LineThickness, 1-(ArcLength (Offset(x,y,z)*10, Angle (x, y, z)-tau)), 0 )} //#declare f_Spiral = function {select (circles (x,y,z) - LineThickness, 20*Offset(x, y, z), 1)} // varying thickness //#declare f_Spiral = function {select (circles (x,y,z) - LineThickness*50*Offset(x, y, z), 20*Offset(x, y, z), 0)} // varying thickness /* #define COLOR_RATE 0.1 #define COLOR_RATE2 0.001 #define COLOR_CONST 0.1 float rate = mod(COLOR_RATE+(iTime*COLOR_RATE2), 2.0*PI); float r = fract(spiral_degrees*rate); float g = fract(spiral_degrees*(rate+COLOR_CONST)); float b = fract(spiral_degrees*(rate+COLOR_CONST+COLOR_CONST)); */ #declare Pattern = function {f_Spiral(x, y, z)} #declare TSpiral = texture { pigment { average pigment_map { [ function { Pattern (x, y, z) } color_map { [ 0 red 0 ] [ 1 red 3 ] } ] [ function { Pattern (x, y, z) } color_map { [ 0 green 0 ] [ 1 green 3 ] } ] [ function { Pattern (x, y, z)} color_map { [ 0 blue 0 ] [ 1 blue 3 ] } ] } // end pigment map } // end pigment } // end layered texture #declare Spiral = pigment {function {f_Spiral(x,y,z)}} plane {z, 0 texture {TSpiral finish {diffuse 1}}} // float offset=abs(o.x)+abs(o.y)+(angle/(2.*PI))*dis; // square spiral // float offset=(log(l)+(angle/(2.*PI))*dis); // log spiral // float offset=(log(l)/log(e*5.)+(angle/(2.*PI))*dis); // wider log spiral