POV-Ray : Newsgroups : povray.newusers : Making a Trefoil Server Time
1 Nov 2024 23:16:51 EDT (-0400)
  Making a Trefoil (Message 1 to 2 of 2)  
From: Sleazy Saint
Subject: Making a Trefoil
Date: 22 Nov 2004 01:10:00
Message: <web.41a1819d52298d4f46d22db00@news.povray.org>
Looking at various pictures of trefoils, such as Tor Olav's, made me want to
create my own. But I have no idea how to.  I tried looking for a formula or
something that would at least point me in the right direction, but so far I
haven't found anything.  Any help is appreciated.


Post a reply to this message

From: Mike Williams
Subject: Re: Making a Trefoil
Date: 22 Nov 2004 03:06:26
Message: <aHQ+tBAh2ZoBFwt1@econym.demon.co.uk>
Wasn't it Sleazy Saint who wrote:
>Looking at various pictures of trefoils, such as Tor Olav's, made me want to
>create my own. But I have no idea how to.  I tried looking for a formula or
>something that would at least point me in the right direction, but so far I
>haven't found anything.  Any help is appreciated.

There's several ways to do it.

Here's a method using a short piece of a helix, transformed by using
cylindrical polar co-ordinates 
(see <http://www.econym.demon.co.uk/isotut/substitute.htm#polar>)

#declare R1=0.3;     // helix minor radius
#declare R2=0.5;     // helix major radius
#declare R3=2.0;     // shape major radius
#declare Strands=2;  // DNA = double strand
#declare Turns=1.5;  // number of helix turns in the loop
#declare Shape=1.5;  // helix1 shape parameter

// Set Strands=2 Turns=1.5 for a trefoil.
// Other low values give other knotted and interlocked shapes
// Turns*Strands should be an integer to avoid a discontinuity
// Shape, max_gradient and contained_by may need to be adjusted
//        when you change any of the other parameters 

// the helix function
#declare F=function { f_helix1 (x, z, y, Strands, Turns, R1, R2, Shape,
1, 0) }

isosurface {
   function{F(f_r(x,y,z)-R3, y, f_th(x,y,z))} // cylindrical polar
        max_gradient 2.5
        contained_by {box {<-3,-1,-3><3,1,3>}}
        pigment {rgb 1}
}


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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