POV-Ray : Newsgroups : povray.general : Hexagon pattern with 4 or 7 colors? : Re: Hexagon pattern with 4 or 7 colors? Server Time
18 May 2024 19:16:24 EDT (-0400)
  Re: Hexagon pattern with 4 or 7 colors?  
From: Kenneth
Date: 30 Apr 2018 15:05:01
Message: <web.5ae7679597bd1601a47873e10@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

>
> However, I'm also wondering if I can't somehow come up with a pattern
> that would allow the tricks over in the bricks pattern thread to be used.
> Or if somehow that trick can be applied to the existing hexagon pattern[s]
> to eliminate the need for writing a special function.

You've inspired me; I'm experimenting with that idea...not with the 'brick'
pattern, but just using the cells pattern for the three hexagon 'triad'
pigments. The *fundamental* idea proves true: that the random cells colors can
create random-colored hexagons. But to get the colors to be scaled and placed
correctly in each hexagon shape requires *some* kind of warp{repeat.. offset
<...>} configuration that I haven't yet figured out. (The hexagon pattern itself
obviously has its own inner repeating/offset behavior, which might be messing
with things. And the cells pattern's default grid-position doesn't match the
layout of the hexagon pattern-- another complication.)

Although hexagon require 3 colors or pigments, it's easier for me at this stage
to use just ONE. (The other two hexagons of the 'triad' turn out black, which is
OK.)

This code is the general idea (horizontal on the x/z plane) -- but where to put
the warp{...} and the scales, and what they should be, is still a 'work in
progress'... ;-) The hexagon shape has 'inner angles' of 120-degrees at it's
points, so some of this code uses sin of 60-degrees to try and get the
cells-pattern scales to properly match the hexagon scales (I had to brush-up on
my trigonometry, ha):

pigment{
    hexagon
    pigment{ // #1
                 cells
                 color_map{
                         [0 rgb <1,0,0>]
                         [.5 rgb <0,1,0>]
                         [1.0 rgb <0,0,1>]
                         }
                 scale 1

                // warp{repeat x offset <0,0,2>} // ???
                 //translate <-.5,0,-.5> // ???
                 scale <2 + 1,1,2*.8660254> // .8660254 is sin of 60-degrees
                 translate <1.5,0,2*.8660254> // ???
            }
   // pigment #2...
   // pigment #3...
       }


Post a reply to this message

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