POV-Ray : Newsgroups : povray.newusers : newbie's question - CSG&Loop : Re: newbie's question - CSG&Loop Server Time
28 Jul 2024 20:24:05 EDT (-0400)
  Re: newbie's question - CSG&Loop  
From: Sherry Shaw
Date: 15 Aug 2007 09:14:58
Message: <46c2fc52@news.povray.org>
dcnstrct wrote:

>hi all.
>as I happily played along with POV I stumbled across the following problem,
>where I seem to lack basic understanding of how things work, example given:
>
>i want the brown thingies to cut holes into the grey block:
>image: www.zensorama.de/rnd_cuts1.jpg
>
>####################################################
>
>camera{
>    location <50,16,50>
>    look_at <0,0,0>
>    angle 40
>  }
>
>
>#declare S = seed(0);
>#declare Index = 1;
>#while(Index <= 300)
>#declare graus = 1*rand(S);             // random farbe
>#declare bocks = box {<1,1,1> .1
>        pigment {rgb<1,0.7,0>}
>        translate <10*rand(S),3,-0.0*rand(S)>
>        scale <0.4*rand(S)-1,4*rand(S),0.4*rand(S)>
>        rotate <0*rand(S), 90*rand(S)-45, 90*rand(S)>
>        };
>    object {bocks rotate <0,90,0> translate <0,5,0> }
>#declare Index = Index + 1;
>#end
>
>
>
>box {<-10,-10,-10>,<10,12,10>
>        pigment { rgb <0.8,0.8,0.8>}
>        translate <0,0,0>
>        rotate <0*rand(S), 0*rand(S), 0*rand(S)>
>        }
>
>####################################################
>
>where and how would I place the CSG? I managed to intersect both objects
>(although this probably gave me 300 big grey blocks first;), I managed to
>subtract the block from the random boxes, but vice versa didn't work...
>
>help appreciated
>
>
>
>
>
>
>  
>
Try this and see if it's what you need:


#declare S = seed(0);
difference {
box {<-10,-10,-10>,<10,12,10>
        pigment { rgb <0.8,0.8,0.8>}
        translate <0,0,0>
        rotate <0*rand(S), 0*rand(S), 0*rand(S)>
        }
#declare Index = 1;
#while(Index <= 300)
#declare graus = 1*rand(S);             // random farbe
#declare bocks = box {<1,1,1> .1
        pigment {rgb<1,0.7,0>}
        translate <10*rand(S),3,-0.0*rand(S)>
        scale <0.4*rand(S)-1,4*rand(S),0.4*rand(S)>
        rotate <0*rand(S), 90*rand(S)-45, 90*rand(S)>
        };
    object {bocks rotate <0,90,0> translate <0,5,0> }
#declare Index = Index + 1;
#end
}

Hope this helps.

--Sherry Shaw

-- 
#macro T(E,N)sphere{x,.4rotate z*E*60translate y*N pigment{wrinkles scale
.3}finish{ambient 1}}#end#local I=0;#while(I<5)T(I,1)T(1-I,-1)#local I=I+
1;#end camera{location-5*z}plane{z,37 pigment{granite color_map{[.7rgb 0]
[1rgb 1]}}finish{ambient 2}}//                                   TenMoons


Post a reply to this message

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