|
![](/i/fill.gif) |
Tom Melly wrote in message <3af14d7a$1@news.povray.org>...
>
>Get back to you later...
>
Try this - you only get an object stretching between junctions, you can also
use any object as your key shape.
// use any object as your building block (needs to take 2 co-ords)
#macro Cylinder_Object(CStart, CEnd, CWidth)
cylinder{CStart, CEnd, CWidth}
#end
#macro Box_Object(BCorner1, BCorner2)
box{BCorner1, BCorner2}
#end
//plane{y, 0 pigment{checker Gray, Green}}
#macro Make_Bolt(LArraySize, LSeed, LWidth, LHeight, LSpread, LBranch,
LCutoff)
#declare myArray = array[LArraySize]
#declare checkCount = -1;
#declare highCount = 0;
#declare arrayCount = 0;
#declare myArray[arrayCount] = <0,0,0>;
#declare myRand = seed(LSeed);
#declare Lightning_Bolt =
merge{
#while (checkCount < highCount)
#declare checkCount = checkCount + 1;
#declare segPosA = myArray[arrayCount];
#declare segPosB = segPosA;
#declare arrayCount = arrayCount + 1;
#declare xPlus = (rand(myRand)-0.5)*LSpread;
#declare zPlus = (rand(myRand)-0.5)*LSpread;
#declare no_base = true;
#while(segPosB.y < LHeight)
#declare xShift = segPosB.x + xPlus;
#declare yShift = segPosB.y + (rand(myRand)/5);
#declare zShift = segPosB.z + zPlus;
#if (yShift > LHeight)
#declare yShift = LHeight;
#end
#declare segPosB = <xShift, yShift, zShift>;
#declare randNum = rand(myRand);
#if (randNum < LBranch & segPosB.y > LCutoff) // we only need a new
cylinder here
Cylinder_Object(segPosA, segPosB, LWidth)
// Box_Object(segPosA, segPosB)
#declare no_base = false;
#declare segPosA = segPosB;
#declare highCount = highCount + 1;
#declare myArray[highCount] = segPosA;
#end
#end
#if(no_base & segPosB.y < LHeight)
Cylinder_Object(segPosA, segPosB, LWidth)
// Box_Object(segPosA, segPosB)
#end
#declare LWidth = (LWidth*0.9);
#end
}
#end
//#macro Make_Bolt(LArraySize, LSeed, LWidth, LHeight, LSpread, LBranch,
LCutoff)
Make_Bolt(500, 11211, 0.03, 6, 0.5, 0.05, 0.5)
object{
Lightning_Bolt
pigment{rgbt 1}
interior{media{emission<3,3,5>*5}}
hollow
rotate x*180
no_shadow
translate y*5
}
Post a reply to this message
|
![](/i/fill.gif) |