|
![](/i/fill.gif) |
In article <B9h### [at] econym demon co uk>, Mike Williams
<mik### [at] econym demon co uk> 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] mac com
TAG(Technical Assistance Group) e-mail: chr### [at] tag povray org
Personal Web page: http://homepage.mac.com/chrishuff/
TAG Web page: http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |