|
|
Version 2 w/ a color randomizer for the components...
#declare RS=seed(938);
//------------------------------------------------Wall
#declare R1=1;
#while(R1<3000)
#declare RX=rand(RS)*50;
#declare RY=rand(RS)*10;
#declare ROD=rand(RS)*1+.5;
#declare RSY=rand(RS)*.5+.5;
#declare RSX=rand(RS)*.5+.5;
#declare RC=int(rand(RS)*5+1);
sphere{<0,0,0>,ROD scale<RSX,RSY,1> translate<RX,RY,0>
texture{pigment{color
#switch(RC)
#case(1) Gray10 #break
#case(2) Gray40 #break
#case(3) Gray50 #break
#case(4) Gray80 #break
#case(5) Gray90 #break
#end
}}}
#declare R1=R1+1;
#end
"Robert J Becraft" <cas### [at] aolcom> wrote in message
news:3caa5992@news.povray.org...
> a) Drive people absolutely nuts and job security...
> b) TOO complex
> c) TOO Much CODE.
>
> Here's my solution...
>
> #declare RS=seed(9938);
> //------------------------------------------------Wall
> #declare R1=1;
> #while(R1<3000)
> #declare RX=rand(RS)*50;
> #declare RY=rand(RS)*10;
> #declare ROD=rand(RS)*1+.5;
> #declare RSY=rand(RS)*.5+.5;
> #declare RSX=rand(RS)*.5+.5;
> sphere{<0,0,0>,ROD scale<RSX,RSY,1> translate<RX,RY,0>
> texture{pigment{color Red}}}
> #declare R1=R1+1;
> #end
>
> I made it only 10 units tall instead of your 25. Looks better.
>
> Regards,
> Robert J Becraft
> aka cas### [at] aolcom
>
> "Tom Melly" <tom### [at] tomandlucouk> wrote in message
> news:3c9b304f@news.povray.org...
> > I'm working on a macro that will hopefully eventually generate a
dry-stone
> wall,
> > but I'm running into problems. In the image below, the wall should
approx.
> fill
> > the area marked out by the yellow cylinders, but it ain't.
> >
> > If anyone can be bothered to:
> >
> > a) work out what I'm trying to do
> > b) work out how I'm trying to do it
> > and
> > c) what's going wrong
> >
> > then here is the code:
> >
> > //start code
> >
> > #version 3.5;
> >
> > #include "colors.inc"
> >
> > global_settings {
> > assumed_gamma 1.0
> > }
> >
> > // ----------------------------------------
> >
> > camera {
> > location <0.0, 1.5, -100.0>
> > look_at <0.0, 1.5, 0.0>
> > }
> >
> >
> > light_source {
> > <0, 0, 0> // light's position (translated below)
> > color rgb <1, 1, 1> // light's color
> > translate <-30, 30, -30>
> > }
> >
> > // ----------------------------------------
> >
> >
> >
> > #macro BuildWall()
> > #declare Rand1 = seed(142);
> > #declare Brick = sphere{0,1 pigment{Red}}
> > #declare Ground = plane{y,0 pigment{Green}}
> > #declare WallLen = 50;
> > #declare WallHi = 15;
> > #declare ThisLen = 0;
> > #declare ThisHi = 0;
> > #declare Wall = object{Ground}
> > #while(ThisLen <= WallLen & ThisHi <= WallHi)
> > #declare XScale = rand(Rand1)*2 + 0.5;
> > #declare YScale = rand(Rand1)*2 + 0.5;
> > #declare ZScale = rand(Rand1)*2 + 0.5;
> > #declare ThisBrick = object{Brick scale<XScale, YScale, ZScale>}
> > #if(ThisLen = 0)
> > #declare Norm = <0, 0, 0>;
> > #declare Start = <0,WallHi*2,0>;
> > #declare InterA = trace ( Wall, Start, <0, -1, 0>, Norm );
> > #declare Wall = union{
> > object{Wall}
> > object{ThisBrick translate y*(InterA.y + YScale)}
> > }
> > #declare ThisLen = XScale;
> > #declare ThisHi = InterA.y + YScale;
> > #else
> > #declare Norm = <0, 0, 0>;
> > #declare Start = <ThisLen+XScale,WallHi*2,0>;
> > #declare InterA = trace ( Wall, Start, <0, -1, 0>, Norm );
> > #if(InterA.y < ThisHi)
> > #declare Norm = <0, 0, 0>;
> > #declare Start = <WallLen*2,InterA.y + YScale,0>;
> > #declare InterB = trace ( Wall, Start, <-1, 0, 0>, Norm );
> > #declare Wall = union{
> > object{Wall}
> > object{ThisBrick translate<InterB.x + XScale, InterA.y +
YScale,
> 0>}
> > }
> > #end
> > #declare ThisLen = InterB.x + (XScale*2);
> > #declare ThisHi = InterA.y + YScale;
> > #if(ThisLen > WallLen & ThisHi <= WallHi)
> > #declare ThisLen = 0;
> > #end
> > #end
> > #end
> > #end
> >
> > BuildWall()
> > object{Wall}
> >
> > cylinder{0,y*25, 0.2 pigment{Yellow}}
> > cylinder{0,y*25, 0.2 pigment{Yellow} translate x*50}
> > cylinder{x*-10,x*60, 0.2 pigment{Yellow} translate y*15}
> >
> > //end code
> >
> > ... and here is the image
> >
> >
> > --
> > #macro G(D,E,F)#local I=array[3]{D,E,F}#local B=0;triangle{#while(
> > B<3)#while(I[B])A[mod(I[B],10)]+#local I[B]=div(I[B],10);#end<-5,-
> > 2,9>#local B=B+1;#end}#end #local A=array[7]{x,x*2,x*4,y,y*2,y*4,z
> > }light_source{-x*6-z*9,1}mesh{G(105,10,146)G(105,246,10)G(105,56,
> > 146)G(105,1256,246)G(1256,126,220)G(22156,2216,201)pigment{rgb 1}}//TM
> >
> >
> >
>
>
>
Post a reply to this message
Attachments:
Download 'TESTwall.jpg' (11 KB)
Preview of image 'TESTwall.jpg'
|
|