POV-Ray : Newsgroups : povray.text.scene-files : A Candy Cane : A Candy Cane Server Time
28 Jul 2024 20:34:02 EDT (-0400)
  A Candy Cane  
From: Ken
Date: 27 Jun 1999 09:06:17
Message: <37762200.B79ABBC7@pacbell.net>
This is the source for a Candy Cane that Chris Huff was kind enough
to share with me.

Enjoy,

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Here is my candy cane, hope it is what you are looking for.

#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
}

  object { CandyCane }


Post a reply to this message

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