POV-Ray : Newsgroups : povray.binaries.images : A nice tiling macro : Re: A nice tiling macro Server Time
18 Aug 2024 14:17:26 EDT (-0400)
  Re: A nice tiling macro  
From: John VanSickle
Date: 19 Apr 2001 16:42:08
Message: <3ADF4E63.2C502498@erols.com>
Christoph Hormann wrote:
> 
> Separate objects or pattern with repeat warps etc?

Pattern only.

Regards,
John

// The macro code
#macro OctoTile(OctA,OctB,Square,Fill,W)
#local tS= texture { Square Matrix((x+z)/2,y,(z-x)/2,<0,0,0>) }
#if(W<=0)
  #local tC= texture { checker texture { OctA }, texture { OctB }
  Matrix((x+z)/2,y,(z-x)/2,<0,0,0>) }
  #local iA=.5-sqrt(.125);
  #local iB=sqrt(.125);
  #local iC=1-sqrt(.125);
  #local iD=.5+sqrt(.125);
  #local tA= texture { gradient x texture_map {
    [iA tS][iA tC][iD tC][iD tS] } }
  #local tB= texture { gradient x texture_map {
    [iB tC][iB tS][iC tS][iC tC] } }
  gradient z Matrix ( x-z,y,x+z,<0,0,0>) texture_map {
  [iA tA][iA tC][iB tC][iB tB][iC tB][iC tC][iD tC][iD tA] }
#else
  #local tC= texture { checker texture { OctA }, texture { OctB } }
  #local tX= texture { gradient x texture_map {
    [W/2 Fill][W/2 tC][1-W/2 tC][1-W/2 Fill] } }
  #local tZ= texture { gradient z texture_map {
    [W/2 Fill][W/2 tX][1-W/2 tX][1-W/2 Fill] }
    Matrix((x+z)/2,y,(z-x)/2,<0,0,0>) }
  #local tF= texture { Fill Matrix((x+z)/2,y,(z-x)/2,<0,0,0>) }
  #local iA=.5-sqrt(.125)*(1+W);
  #local iB=.5-sqrt(.125)*(1-W);
  #local iC=.5+sqrt(.125)*(1-W);
  #local iD=.5+sqrt(.125)*(1+W);
  #local tA=texture { gradient x texture_map {
    [iA tS][iA tF][iB tF][iB tZ][iC tZ][iC tF][iD tF][iD tS] } }
  #local iE=sqrt(.125)*(1-W);
  #local iF=sqrt(.125)*(1+W);
  #local iG=1-sqrt(.125)*(1+W);
  #local iH=1-sqrt(.125)*(1-W);
  #local tB=texture { gradient x texture_map {
    [iE tZ][iE tF][iF tF][iF tS][iG tS][iG tF][iH tF][iH tZ] } }
  #local tC=texture { gradient x texture_map {
    [iB tF][iB tZ][iC tZ][iC tF] } }
  #local tD=texture { gradient x texture_map {
    [iE tZ][iE tF][iH tF][iH tZ] } }
  #local sDummy=0;
  gradient z Matrix(x-z,y,x+z,<0,0,0>) texture_map {
  [iA tA][iA tC][iB tC][iB tZ][iE tZ][iE tD][iF tD][iF tB]
  [iG tB][iG tD][iH tD][iH tZ][iC tZ][iC tC][iD tC][iD tA] }
#end
#end

// to use it

plane { y,0
  texture {
    OctoTile(OctText1,OctText2,SquareText,FillText,FillWidth)
  }
}


Post a reply to this message

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