POV-Ray : Newsgroups : povray.advanced-users : hexagon pattern + pigment pattern : Re: hexagon pattern + pigment pattern Server Time
19 Apr 2024 15:35:22 EDT (-0400)
  Re: hexagon pattern + pigment pattern  
From: Bald Eagle
Date: 28 Oct 2017 00:30:01
Message: <web.59f406cde7a40c9f5cafe28e0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> I think I might have to write a function pigment with mod() to pattern the
> plane.

All ye here, witness thee the math[s] suckification:

(at least the pattern sorta matches up with the spheres...)

#version 3.71;

global_settings {
 assumed_gamma 1.0
}

#declare Aspect = image_width/image_height;
camera {
 location <0, 15, -0.001>
 right x*Aspect
 look_at <0, 0, 0>
}

#include "colors.inc"
#include "stbHexPatterns.inc"

light_source {<0, 50, 0> 1}

#declare Hole =
pigment {
  cylindrical   // cylinder shaped gradient along the Y-axis
  color_map {
               [0.0 White]
               [0.5 White]
               [0.5 Black]
               [1.0 Black]
  }
}

#declare Hex = 2*sin (pi/3);
// 0.03655205525709550570167739213998

//#declare HexGrid = function { abs(x + mod(x, 2)*1.5) + abs(z + mod(z,
sin(pi/3))) + sqrt(pow(x,2)+pow(z,2)) + 0*y}
//#declare HexGrid = function { x + mod(x, 2)*1.5 + z + mod(z, sin(pi/3)) +
sqrt(pow(x + mod(x, 2)*1.5,2)+pow(z + mod(z, sin(pi/3)),2)) + 0*y}
//#declare HexGrid = function { (x + mod(x/2, 2)*1.5) + (z + mod(z, sin(pi/3)))
+ sqrt(pow(x + mod(x, 2)*1.5,2)+pow(z + mod(z, sin(pi/3)),2)) + 0*y}
//#declare HexGrid = function { (x + mod(sqrt(pow(x + mod(x, 2)*1.5,2)+pow(z +
mod(z, sin(pi/3)),2)), 2)*1.5) + (z + mod(sqrt(pow(x + mod(x, 2)*1.5,2)+pow(z +
mod(z, sin(pi/3)),2)), sin(pi/3))) + 0*y}

//#declare HexGrid = function {select ( sin(z*Hex/3),
mod(abs(x),2)+sqrt(pow(mod(abs(x),2),2)+pow(mod(abs(z),2),2)-1),
mod(abs(x),2)+sqrt(pow(mod(abs(x),2),2)-0.5+pow(mod(abs(z),2),2))-0.5,
mod(abs(x),2)+sqrt(pow(mod(abs(x),2),2)+pow(mod(abs(z),2),2)-Hex) )}

//#declare HexGrid = function {select ( sin(z*Hex),
mod(abs(x),2)+sqrt(pow(mod(abs(x),2),2)+pow(mod(abs(z),2),2)-1), 0, 1 )}

#declare XStep = 3;
#declare ZZ1 = function {x+sin(z*Hex/2)}
#declare ZZ = function {x+sin(z*2*Hex)}
//#declare Cyl = function {sqrt (pow(x,2)+pow(z,2))*2}
#declare Cyl = function {sqrt (pow(ZZ1(x, y, z),2)+pow(z,2))/3}
//#declare HexGrid = function {Cyl (mod(abs(x),XStep)-XStep/2, y,
mod(abs(z),Hex/2)-Hex/4)}

#declare HexGrid = function {Cyl (mod(abs(ZZ(x, y, z)),XStep)-XStep/2, y,
mod(abs(z),Hex/2)-Hex/4)}
//#declare HexGrid = function {Cyl (mod(abs(x),XStep)-XStep/2, y,
mod(abs(z),Hex/2)-Hex/4)}
sphere {0, 1/5 pigment {Green}}
plane {y, 0
 pigment {
   //function {HexGrid (x, y, z)} translate x*1.5 translate z*Hex/4
   function {HexGrid (x, y, z)} translate x*0.75 translate z*Hex/4
   //pigment {Hole},
   //pigment {Hole translate<0, 0,   Hex>},
   //pigment {Hole translate<0, 0, 2*Hex>}
  }
 }

union {
    #local R = 1;
    #local XN = 10;
    #local YN = 20;
    #local J = -YN;
    #while(J < YN)
        #local K = -XN;
        #while(K < XN)
            sphere {< K*3*R + mod(J, 2)*1.5*R, 0, sin(pi/3)*R*J>, R/10}
//          sphere {< K*3*R + 1.5*J*R, sin(pi/3)*R*J, 0>, R}
            #local K = K + 1;
        #end
        #local J = J + 1;
    #end
    texture {
        pigment {Red}
    }
}


Maybe this needs to be done similar to the way isosurfaces are blobbed
together....


Post a reply to this message

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