|
![](/i/fill.gif) |
"Tom Melly" <tom### [at] tomandlu co uk> wrote in message
news:3cc4283d@news.povray.org...
BTW here's the code (which is based on some lightning code I wrote ages ago):
#macro Cylinder_Object(CStart, CVec, CWidth, CAng, CLev)
#local cylLen = 4 * ((rand(myRand) + 0.5)/CLev);
#local cylTran = transform{
rotate x*(2 * CAng * rand(myRand) - CAng)
rotate y*(360 * rand(myRand))
Reorient_Trans(y * 1, CVec)
translate CStart
}
#declare segPosB = vtransform(y * cylLen, cylTran);
#declare segVec = segPosB - CStart;
cylinder{
0, y * cylLen, CWidth, 1
transform{cylTran}
}
#end
#macro Make_Tree(TArraySize, TSeed, TBWidth, THt, TCutoff, TBranch, TAng, TLevs)
#declare PosArray = array[TArraySize];
#declare VecArray = array[TArraySize];
#declare WidArray = array[TArraySize];
#declare LevArray = array[TArraySize];
#declare PosArray[0] = <0,0,0>;
#declare VecArray[0] = <0,1,0>;
#declare WidArray[0] = TBWidth;
#declare LevArray[0] = 1;
#declare checkCount = -1;
#declare highCount = 0;
#declare myRand = seed(TSeed);
#declare Tree =
blob{
threshold 0.5
#while (checkCount < highCount)
#declare checkCount = checkCount + 1;
#declare segPosA = PosArray[checkCount];
#declare segVec = VecArray[checkCount];
#declare segWidth = WidArray[checkCount];
#declare segLev = LevArray[checkCount];
#declare segPosB = segPosA;
#declare CarryOn = true;
#while(vlength(segPosB) < THt & segWidth > 0.05 & CarryOn)
#declare segPosA = segPosB;
Cylinder_Object(segPosA, segVec, segWidth, TAng, segLev)
#declare randNum = rand(myRand);
#if(randNum > 1 - ((segLev^2)/500))
#declare CarryOn = false;
#end
#if (randNum < (TBranch/(segLev^0.25)) & segLev < TLevs &
vlength(segPosB) > TCutoff)
#declare segWidth = segWidth * 0.75;
#declare highCount = highCount + 1;
#declare PosArray[highCount] = segPosB;
#declare VecArray[highCount] = segVec;
#declare WidArray[highCount] = segWidth * 0.95;
#declare LevArray[highCount] = segLev + 1;
#end
#end
#end
}
#end
//#macro Make_Tree(TArraySize, TSeed, TBWidth, THt, TCutoff, TBranch, TAng,
TLevs)
Make_Tree(50000, 1868, 5, 40, 8, 0.45, 30, 9)
object{Tree pigment{Gray50}}
Post a reply to this message
|
![](/i/fill.gif) |