|
|
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
|
|