POV-Ray : Newsgroups : povray.text.scene-files : Twisted Iso Torus : Re: Twisted Iso Torus Server Time
28 Jul 2024 12:32:54 EDT (-0400)
  Re: Twisted Iso Torus  
From: Chris Huff
Date: 6 Jul 2000 10:57:15
Message: <chrishuff-0BB98A.09572906072000@news.povray.org>
In article <B9h### [at] econymdemoncouk>, Mike Williams 
<mik### [at] econymdemoncouk> wrote:

> /* It's possible to create a twisted torus as a parametric isosurface.
>    What I've done here is to work out a set of parametric equations for
>    a torus, and then apply a cyclic displacement factor.
> 
>    The size of the major and minor radii, the number of twists and the
>    amplitude of the twist displacement are all configurable.
> */

It can also be done as a non-parametric equation, like this:

#declare Angle = function {atan2(x, y)*z}
// Angle(CoordinateA, CoordinateB, Frequency)

#declare R0 = 2;//Major radius
#declare R1 = 0.5;//Minor radius
#declare A = 0.2;//Ridge amplitude
#declare NT = 8;//Number of twists
#declare NR = 3;//Number of ridges
#declare twistTorFunc = 
function {
        sqrt(sqr(sqrt(sqr(x)+sqr(z)) - R0)+sqr(y))
        -R1+cos(Angle(x,z,NT)+Angle(sqrt(sqr(x)+sqr(z)) - R0,y,NR))*A
}

isosurface {
    function {twistTorFunc(x,y,z)}
    threshold 0
    eval
    max_gradient 2
    contained_by {box {<-3,-1, 0>, < 3, 1, 3>}}
    pigment {color rgb <1,1,0.35>}
}

It's a lot shorter, too. :-)

-- 
Christopher James Huff - Personal e-mail: chr### [at] maccom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://homepage.mac.com/chrishuff/
TAG Web page: http://tag.povray.org/


Post a reply to this message

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