POV-Ray : Newsgroups : povray.newusers : Helixes : Re: Helixes Server Time
30 Jul 2024 04:13:45 EDT (-0400)
  Re: Helixes  
From: Mike Williams
Date: 7 Feb 2005 05:26:44
Message: <raOiKCA+H0BCFweI@econym.demon.co.uk>
Wasn't it Oleguer Vilella who wrote:
>Hi all,
>
>I will post an object on povray.binaries.images
>I'm traying to make this object using POV-Ray. I was traying doing it like 
>an helix with some different functions, the problem is that I don't know how 
>can I do the extensions.

I usually suggest isosurfaces for just about everything, but in this
case a sphere_sweep is probably easier. Here's some code to get you
started.

The UNIT is one helical strand with an extension. The path follows a
helix shape until N=P2, then starts to do other things. Four copies of
the UNIT are used to create a double strand helix with extensions at
each end.

I start the sphere_sweep at N-1, to make it much easier to join the four
UNITs correctly. Since the sphere_sweep starts at the second point, it's
tricky to get them to match in the middle if the second point is N=1;

Try different values of A, B, C, D, E and F.

You could also turn the UNIT into a macro, and produce four units with
different parameter settings, so that you get differently shaped
extensions.

#version 3.6;
global_settings {assumed_gamma 1.0}
camera {location  <0,0,-10> look_at <0,0,0> angle 35}
background {rgb 1}
light_source {<-30, 100, -30> color rgb 1}

// ----------------------------------------

#declare Points=30; // total number of control points
#declare P2=22;     // control point where extension starts

#declare R1=0.1;  // minor radius
#declare R2=0.3;  // major radius
#declare A=25.0;  // controls turniness
#declare B=1.5;   // controls height
#declare C=0.4;   // controls sideways spread of the extensions
#declare D=2.0;   // controls the stretch of the extensions
#declare E=0.2;   // controls waviness of extensions
#declare F=1.5;   // controls frequency of wave extensions

#declare UNIT=
sphere_sweep {
  cubic_spline
  Points,
  #declare N=-1;
  #while (N<Points-1)
    #if (N<P2)
      #declare X=R2*sin(A*N/Points);
      #declare Y=B*N/Points;
      #declare Z=R2*cos(A*N/Points);
    #else
      #declare X=R2*(1+(N-P2)*C)*sin(A*N/Points);
      #declare Y=B*N/Points + sin(F*A*(N-P2)/Points)*E 
               + B*D*(N-P2)/Points;
      #declare Z=R2*(1+(N-P2)*C)*cos(A*N/Points);
    #end
    <X,Y,Z>,R1
    #declare N=N+1;
  #end
  pigment {rgb 1}
  no_shadow
}  

object {UNIT}
object {UNIT rotate y*180}
object {UNIT rotate z*180}
object {UNIT rotate z*180 rotate y*180}


Post a reply to this message

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