POV-Ray : Newsgroups : povray.windows : how to create a random coil : Re: how to create a random coil Server Time
17 May 2024 03:59:09 EDT (-0400)
  Re: how to create a random coil  
From: Charles C
Date: 19 Oct 2007 19:16:27
Message: <47193acb@news.povray.org>
zj905 wrote:
> I am doing some work on chemistry. The random coil looks like... It is
> better to give a sample. Please see this picture:
> http://www.psc.edu/science/Darden/bpti_spline_dense2.GIF. In this graph,
> the white-yellow chains are random coils. How to draw that? Thanks.


I typed something up but seeing this picture makes me think it might not 
be quite what you're looking for either.  (Looks like my lines are a 
little too long.) I'm posting it anyway in case it might still have some 
relevance:

Charles

//          /
//****   o-/--   ************************
//        o

#include "colors.inc"

global_settings {
   assumed_gamma 1.0
}

camera {
   location  <0.0, 0.5, -4.0>
   direction 1.5*z
   right     x*image_width/image_height
   look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
   pigment {
     gradient z
     color_map {
       [0.0 rgb <0.6,0.7,1.0>]
       [0.7 rgb <0.0,0.1,0.8>]
     }
   }
}

light_source {
   <0, 0, 0>            // light's position (translated below)
   color rgb <1, 1, 1>  // light's color
   translate <-30, 30, -30>
}

// ^^^^^ The above is modified from the POV-Ray for Windows insert menu 
^^^^^


#declare Wraps = 10;
#declare BallRad = 1;
#declare Increment_Val = 0.001;
#declare Ctr = 0-Increment_Val;
#declare MyRand = seed(0);
#declare ThisRandVec = <rand(MyRand),rand(MyRand),rand(MyRand)>;
//
#declare MySpline =
spline{cubic_spline
   //Ctr, 
vrotate(<BallRad,0,0>,<rand(MyRand),rand(MyRand),rand(MyRand)>*360),
   Ctr, vrotate(<BallRad,0,0>,ThisRandVec*360*Ctr*Wraps),
   #declare Ctr = Ctr+Increment_Val; //now 0.... could'a just written 0.
   #while(Ctr <= 1+Increment_Val)
       //Ctr, vrotate(<1,0,0>,<rand(MyRand),rand(MyRand),rand(MyRand)>*360),
         Ctr, vrotate(<BallRad,0,0>,ThisRandVec*360*Ctr*Wraps),
       #declare Ctr = Ctr+Increment_Val;
   #end //end while
}//end spline


#declare SphereRad = .01;
#declare NumOfSpheres = 10000;
#declare Ctr = 0;
#declare A_Random_Coil =
union{
  #local Ctr = 0;
  #while (Ctr <= 1)
    sphere {
      MySpline(Ctr),SphereRad
      pigment { rgb <1-Ctr,Ctr,0> }
      }
    #local Ctr = Ctr + 1/NumOfSpheres;
  #end
} //end union


#object{A_Random_Coil}

//          /
//****   o-/--   ************************
//        o


Post a reply to this message

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