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: Christopher James Huff
Date: 20 Dec 2002 18:08:43
Message: <chrishuff-C6FB3F.18033620122002@netplex.aussie.org>
In article <web.3e0394626c2b88df6e6484130@news.povray.org>,
 "hrisedorph" <nomail@nomail> wrote:

> What I want to do is make a candy cane. I set up the gradient map for the
> straight parts, but in the hook part, I can't get it to look right. I
> *could* just use one overall pattern, but it's not really ... it just sort
> of goes diagonally across the ring instead of winding around it. I'm pretty
> new to this, so when I found a news post that basically tells exactly how
> to make it, I didn't understand what was meant.

Try this:
torus {1, 0.2
    texture {
        pigment {
            function {(atan2(1 - sqrt(x*x + z*z), y) + 6*atan2(z, x))/pi}
            color_map {
                [0 color rgb 0]
                [1 color rgb < 1, 0, 0>]
            }
        }
    }
}

Or a macro to make adjusting it easier:
#macro TorusSpiralPtrn(MajorRadius, Stripes, Spirals)
    function {
        (atan2(MajorRadius - Stripes*sqrt(x*x + z*z), y) + 
Spirals*atan2(z, x))/pi
    }
#end

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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