POV-Ray : Newsgroups : povray.windows : how to create a random coil Server Time
2 May 2024 12:54:57 EDT (-0400)
  how to create a random coil (Message 1 to 10 of 16)  
Goto Latest 10 Messages Next 6 Messages >>>
From: zj905
Subject: how to create a random coil
Date: 17 Oct 2007 20:30:01
Message: <web.4716a7eca1216bf14f7090800@news.povray.org>
Anybody knows how to draw a random coil in povray? I am very interested in
doing this but not capable of doing it. I need help. Thanks in advance.


Post a reply to this message

From: St 
Subject: Re: how to create a random coil
Date: 17 Oct 2007 23:06:33
Message: <4716cdb9$1@news.povray.org>
"zj905" <zj9### [at] hotmailcom> wrote in message 
news:web.4716a7eca1216bf14f7090800@news.povray.org...
> Anybody knows how to draw a random coil in povray? I am very interested in
> doing this but not capable of doing it. I need help. Thanks in advance.


   Google Is Your Friend: 
http://www.geocities.com/ccolefax/download/coil.txt

    (Note that the code shown there is for pov3.1 but it shouldn't be a 
problem).



    Or, you could experiment with this:



 #declare Ball =
 sphere{<0,0,0>,0.15 scale <1,1,1> rotate<0,0,0> translate<0,0,0>
 texture{pigment{ color rgb<1,0.7,0>}
                finish { diffuse 0.9 phong 1}}}

union{
 #local Nr = 0;            // start
 #local N_per_Rev = 500;   // Number of Elements per revolutions
 #local N_of_Rev  = 4.25;  // Total number of revolutions
 #while (Nr< N_per_Rev*N_of_Rev)
   object{Ball translate<1,Nr*0.45/N_per_Rev,0>
               rotate<0,Nr * 360/N_per_Rev,0>}

 #local Nr = Nr + 1;    // next Nr
 #end // ---------------  end of loop
rotate<0,0,0>
translate<0,0,0>} // end of union


    ~Steve~


Post a reply to this message

From: zj905
Subject: Re: how to create a random coil
Date: 19 Oct 2007 17:20:01
Message: <web.47191ece144555e34849a21c0@news.povray.org>
Thanks. But it looks like a helix. How to get a "random" coil?
"St." <dot### [at] dotcom> wrote:
> "zj905" <zj9### [at] hotmailcom> wrote in message
> news:web.4716a7eca1216bf14f7090800@news.povray.org...
> > Anybody knows how to draw a random coil in povray? I am very interested in
> > doing this but not capable of doing it. I need help. Thanks in advance.
>
>
>    Google Is Your Friend:
> http://www.geocities.com/ccolefax/download/coil.txt
>
>     (Note that the code shown there is for pov3.1 but it shouldn't be a
> problem).
>
>
>
>     Or, you could experiment with this:
>
>
>
>  #declare Ball =
>  sphere{<0,0,0>,0.15 scale <1,1,1> rotate<0,0,0> translate<0,0,0>
>  texture{pigment{ color rgb<1,0.7,0>}
>                 finish { diffuse 0.9 phong 1}}}
>
> union{
>  #local Nr = 0;            // start
>  #local N_per_Rev = 500;   // Number of Elements per revolutions
>  #local N_of_Rev  = 4.25;  // Total number of revolutions
>  #while (Nr< N_per_Rev*N_of_Rev)
>    object{Ball translate<1,Nr*0.45/N_per_Rev,0>
>                rotate<0,Nr * 360/N_per_Rev,0>}
>
>  #local Nr = Nr + 1;    // next Nr
>  #end // ---------------  end of loop
> rotate<0,0,0>
> translate<0,0,0>} // end of union
>
>
>     ~Steve~


Post a reply to this message

From: St 
Subject: Re: how to create a random coil
Date: 19 Oct 2007 18:06:56
Message: <47192a80$1@news.povray.org>
"zj905" <zj9### [at] hotmailcom> wrote in message 
news:web.47191ece144555e34849a21c0@news.povray.org...
> Thanks. But it looks like a helix. How to get a "random" coil?

  Ok, sorry that didn't help. It really depends on what you mean by 
'random'.

   ~Steve~


Post a reply to this message

From: zj905
Subject: Re: how to create a random coil
Date: 19 Oct 2007 19:05:00
Message: <web.471937b9144555e34849a21c0@news.povray.org>
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.



"St." <dot### [at] dotcom> wrote:
> "zj905" <zj9### [at] hotmailcom> wrote in message
> news:web.47191ece144555e34849a21c0@news.povray.org...
> > Thanks. But it looks like a helix. How to get a "random" coil?
>
>   Ok, sorry that didn't help. It really depends on what you mean by
> 'random'.
>
>    ~Steve~


Post a reply to this message

From: Charles C
Subject: Re: how to create a random coil
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

From: zj905
Subject: Re: how to create a random coil
Date: 19 Oct 2007 20:35:00
Message: <web.47194d14144555e34849a21c0@news.povray.org>
Thanks. It is pretty close to what I want. Here is a beautiful image
demonstrating what I want to plot:
http://web.mit.edu/newsoffice/2003/smartsurface.html. Lots of chains were
grafted on a surface. They are rooted on the surface and grow upward
randomly. Any good suggestion?
Charles C <"nospam a nospam.com"> wrote:
> 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

From: Charles C
Subject: Re: how to create a random coil
Date: 19 Oct 2007 21:31:17
Message: <47195a65@news.povray.org>
zj905 wrote:
> Thanks. It is pretty close to what I want. Here is a beautiful image
> demonstrating what I want to plot:
> http://web.mit.edu/newsoffice/2003/smartsurface.html. Lots of chains were
> grafted on a surface. They are rooted on the surface and grow upward
> randomly. Any good suggestion?

Hmm, have a look at this.   I hope you don't mind rough inline-code 
examples rather than a paragraph descriptions.

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 = 100;
//#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 = .001;
//#declare NumOfSpheres = 100000;
//#declare Ctr = 0;
//#declare A_Random_Coil =
//union{
// #local Ctr = 0;
// #while (Ctr <= 1)
//   sphere {
//     MySpline(Ctr),SphereRad
//     pigment { rgb <1-Ctr,Ctr,0> }
//     }
//   #ifdef(LastSpot)
//        cylinder{
//          MySpline(LastSpot),MySpline(Ctr), SphereRad
//          pigment { rgb <1-Ctr,Ctr,0> }
//        }
//   #end //end ifdef
//   #local LastSpot = Ctr;
//   #local Ctr = Ctr + 1/NumOfSpheres;
// #end
//} //end union
//
//
//#object{A_Random_Coil}

// 
********************************************************************************

#declare MyRand = seed(0);
#local TheHeight = 1;
#local Wiggliness = .2; //it's a scale factor

#local GridLength_X = 7;
#local GridLength_Z = 7;
#local GridDiv_X = 10;
#local GridDiv_Z = 10;
#local Ctr_X = 0;
#local Ctr_Z = 0;


#declare SphereRad = .01;
#declare NumOfSpheres = 10;
#declare CtrS = 0;

#declare TheBigGrid =
union{
   #local Ctr_X = 0;
   #while (Ctr_X < 15)
         #local Ctr_Z = 0;
         #while (Ctr_Z < 15)
             #local MySpline =
                 spline{ cubic_spline
                         -.1,                           //pos
                         <Ctr_X*GridLength_X/GridDiv_X, //x
                         -TheHeight/10,                 //y
                         Ctr_Z*GridLength_Z/GridDiv_Z>, //z

                         0,                             //pos
                         <Ctr_X*GridLength_X/GridDiv_X, //x
                         0,                             //y
                         Ctr_Z*GridLength_Z/GridDiv_Z>, //z

                         .5,                            //pos
                         <Ctr_X*GridLength_X/GridDiv_X  //x
                         +(rand(MyRand)-.5)*Wiggliness, //x
                         TheHeight/2,                   //y
                         Ctr_Z*GridLength_Z/GridDiv_Z   //z
                         +(rand(MyRand)-.5)*Wiggliness> //z

                         1,                             //pos
                         <Ctr_X*GridLength_X/GridDiv_X  //x
                         +(rand(MyRand)-.5)*Wiggliness, //x
                         TheHeight,                     //y
                         Ctr_Z*GridLength_Z/GridDiv_Z   //z
                         +(rand(MyRand)-.5)*Wiggliness> //z

                         1.1,                           //pos
                         <Ctr_X*GridLength_X/GridDiv_X  //x
                         +(rand(MyRand)-.5)*Wiggliness, //x
                         TheHeight*1.1                  //y
                         Ctr_Z*GridLength_Z/GridDiv_Z   //z
                         +(rand(MyRand)-.5)*Wiggliness> //z


                       }//end spline


                       union{
                       #local CtrS = 0;
                       #while (CtrS <= 1)
                         sphere {
                           MySpline(CtrS),SphereRad
                           pigment {rgb <1-CtrS,CtrS,0>}
                           }
                         #ifdef(LastSpot)
                              cylinder{
                                MySpline(LastSpot),
                                MySpline(CtrS),
                                SphereRad
                                pigment {rgb <1-CtrS,CtrS,0>}
                              }
                         #end //end ifdef
                         #local LastSpot = CtrS;
                         #local CtrS = CtrS + 1/NumOfSpheres;
                       #end
                      } //end union
                      #undef LastSpot
                      sphere{MySpline(1),
                            SphereRad*7
                            pigment{rgb <1,1,0>}
                      } //end sphere



                 #local Ctr_Z = Ctr_Z + 1;
         #end //end #while (Ctr_Z < 15)
         #local Ctr_X = Ctr_X + 1;
   #end //end #while (Ctr_X < 15)
} //end union TheBigGrid

object{TheBigGrid
        translate <-GridLength_X/2,0,-GridLength_Z/2>
        rotate y*50
}



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


Post a reply to this message

From: Charles C
Subject: Re: how to create a random coil
Date: 19 Oct 2007 21:51:33
Message: <47195f25@news.povray.org>
PS I'd meant to put #while (Ctr_X < GridDiv_X) instead of #while (Ctr_X 
< 15).  Same for Z.


Post a reply to this message

From: zj905
Subject: Re: how to create a random coil
Date: 19 Oct 2007 22:45:01
Message: <web.47196b8b144555e34f7090800@news.povray.org>
You are a really expert!! Admire! Thanks.
If I have new problem, where can I find you?

Charles C <"nospam a nospam.com"> wrote:
> PS I'd meant to put #while (Ctr_X < GridDiv_X) instead of #while (Ctr_X
> < 15).  Same for Z.


Post a reply to this message

Goto Latest 10 Messages Next 6 Messages >>>

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