POV-Ray : Newsgroups : povray.newusers : Circular Helix : Re: Circular Helix Server Time
30 Jul 2024 08:20:07 EDT (-0400)
  Re: Circular Helix  
From: Mike Williams
Date: 27 Oct 2004 22:22:33
Message: <jD80eBAMfFgBFwLy@econym.demon.co.uk>
Here's an alternative way of getting a circular helix that's a bit
easier to manage than f_helical_torus. What you do is first create an
ordinary f_helix1, then translate it off to one side and transform it
into cylindrical polar co-ordinates. This gives you access to the
f_helix1 control parameters which are better understood than the
f_helical_torus parameters. 

I did the translation (x => x-R3) as a separate step from the 
co-ordinate change (x => f_r(x,z,y) , y => f_th(x,z,y)) to keep things
simple.

The use of (x,z,y) rather than (x,y,z) is due to the fact that f_th is
defined as atan2(x,z), whereas I wanted atan2(x,y).

#version 3.6;
global_settings {assumed_gamma 1.0}
#include "functions.inc"

camera {location  <0,0, -20> look_at 0 angle 20}
light_source { <-100,200,-300> colour rgb 1 }
background { rgb 0 }

#declare R1=0.1;     // helix minor radius
#declare R2=0.3;     // helix major radius
#declare R3=2.0;     // torus major radius
#declare Strands=2;  // DNA = double strand

#declare Turns=8.5;  // number of helix turns in the loop
                     // Turns*Strands should be an integer
                     // to avoid a discontinuity 

#declare DNA=function { f_helix1 (x-R3, y, z, Strands,
                        Turns, R1, R2, 1, 1, 0) }

isosurface {
   function{DNA(f_r(x,z,y) ,f_th(x,z,y),z)}
        max_gradient 1.3
        contained_by {sphere {0, 3} }
        pigment {rgb 1}
}



For real DNA, the two strands aren't 180 degrees out of phase like this.
I'm not sure what the exact phase difference is, but here's a version
with the strands 120 degrees out of phase. If you know what the phase
difference should be, you can plug that number in where I've written
"120".

I've also changed the "shape parameter" from 1.0 to 0.6 in this version
to compensate for the fact that the change of co-ordinates had caused
the cross section to become elliptical instead of circular. This will
probably need to be adjusted whenever you change things like R3 and
Turns.

#version 3.6;
global_settings {assumed_gamma 1.0}
#include "functions.inc"

camera {location  <0,0, -20> look_at 0 angle 20}
light_source { <-100,200,-300> colour rgb 1 }
background { rgb 0 }

#declare R1=0.15;    // helix minor radius
#declare R2=0.3;     // helix major radius
#declare R3=2.0;     // torus major radius
#declare Strands=1;  // DNA = double strand

#declare Turns=8;    // number of helix turns in the loop
                     // Turns*Strands should be an integer
                     // to avoid a discontinuity 

#declare DNA=function { f_helix1 (x-R3, y, z, Strands,
                        Turns, R1, R2, 0.6, 1, 0) }

#declare Strand=
isosurface {
   function{DNA(f_r(x,z,y) ,f_th(x,z,y),z)}
        max_gradient 1.3
        contained_by {sphere {0, 3} }
        pigment {rgb 1}
}

object{Strand}
object{Strand rotate z*120/Turns}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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