POV-Ray : Newsgroups : povray.newusers : Candy cane torus pattern : Re: Candy cane torus pattern Server Time
31 Jul 2024 06:25:28 EDT (-0400)
  Re: Candy cane torus pattern  
From: Ken
Date: 20 Dec 2002 21:16:42
Message: <3E03CFA7.C4F77031@pacbell.net>
Christopher James Huff wrote:

> Try this:

Or, a candycane you shared with me about 3 years ago -

#declare CandyCane =
union {
 #declare ccTex =
 texture {
  pigment  {
   radial
   frequency 2
   color_map {
    [ 0.0 color rgb < 0.933333, 0.933333, 0.933333 > ]
    [ 0.475 color rgb < 0.933333, 0.933333, 0.933333 > ]
    [ 0.525 color rgb < 0.937255, 0.121569, 0.113725 > ]
    [ 1.0 color rgb < 0.937255, 0.121569, 0.113725 > ]
   }
  }
 }
 //***User Parameters
 #declare stickParts = 100;
 #declare stickLen = 2;
 #declare totalRot = 360;
 //***
 sphere  { < 0, 0, 0 >, 0.1 texture {ccTex}}
 //***Loop Initialization
 #declare partRot = totalRot/stickParts;
 #declare k=0;
 #while(k < stickParts)
  #declare segSt = < 0, stickLen/stickParts*k, 0 >;
  #declare segEnd = < 0, stickLen/stickParts*(k+1), 0 >;

  cylinder {segSt, segEnd, 0.1 texture {ccTex rotate < 0, partRot*k, 0>}}

  #declare k=k+1;
 #end

 //***User Parameters
 #declare curveParts = 100;
 #declare curveArc = 200;
 #declare curveRad = 0.5;
 //***
 //***Loop Initialization
 #declare curveLen = curveRad*2*pi*(curveArc/360);
 #declare k=0;
 #while(k < curveParts)

  sphere {< 0, 0, 0 >, 0.1
   texture {ccTex rotate < 0, partRot*k, 0>}
   translate < -(curveRad), 0, 0>
   rotate < 0, 0, -k*(curveArc/curveParts)>
   translate < curveRad, stickLen, 0>
  }

  #declare k=k+1;
 #end
}

-- 
Ken Tyler


Post a reply to this message

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