POV-Ray : Newsgroups : povray.text.scene-files : Latice work Macros and examples : Latice work Macros and examples Server Time
28 Jul 2024 16:17:57 EDT (-0400)
  Latice work Macros and examples  
From: Steve
Date: 1 Nov 1999 17:34:38
Message: <381E10A6.E39B11D8@ndirect.co.uk>
Textures must be declared before the macro call, but you can
change that if you wnat to.

The paramaters VVertical and HHorizontal refer to the amount
of pov units you want to fill, so if you use

object{Laticework(10,10,0.5,T_Wood31)}  

the finished product will cover an area <-5,-5,-0.25>,
<5,5,0.25>.  obviously you can translate and rotate after
calling.  

The version that uses cylinders instead of a box for the
center piece is CylLatice which is also icluded
below.

Enjoy
Steve


// ***************************************  Laticework 
***********************************

#macro
Laticework(VVertical,HHorizontal,Thickness,LaticeTexture)
  #declare LongBox
=                                                                       
  union{
       
box{<-1.5,-0.25,-(Thickness/2)>,<1.5,0.25,Thickness/2>}                               
                                       
        box{<-0.5,-0.5,-(Thickness/2)>,<0.5,0.5,Thickness/2>
rotate z*45}
       
       }//End of
union                                                                  
                         
  #declare LaticePiece=
  union{
        object{LongBox}
        object{LongBox translate y*2.5}
        object{LongBox rotate z*-90 translate <1.25,1.25,0>}
        object{LongBox rotate z*-90 translate
<-1.25,1.25,0>}
       
        rotate z*45
        scale<0.25,0.25,1>
        
       }                    

  union{
        #local Accross=0;
        #local MoveIt=0.875;
        
        #while(Accross<HHorizontal)
  
          #local UpDown=0;
  
          #while(UpDown<VVertical)           
            object{LaticePiece translate <Accross,UpDown,0>}
            #local UpDown=UpDown+MoveIt;
          #end    
      
          #local Accross=Accross+MoveIt;

        #end //End of outer While.
       
        texture{LaticeTexture}      
        translate<-(HHorizontal/2),-(VVertical/2),0>
       } //End of union.

#end  //End of macro. 

//**************************  CylLatice  
************************************************

#macro
CylLaticework(VVertical,HHorizontal,Thickness,LaticeTexture)
  #declare LongBox
=                                                                       
  union{
       
box{<-1.5,-0.25,-(Thickness/2)>,<1.5,0.25,Thickness/2>}                               
               
        cylinder{<0,0,-(Thickness/2)>,<0,0,Thickness/2>,0.5}
        
       }//End of
union                                                                  
                         
  #declare LaticePiece=
  union{
        object{LongBox}
        object{LongBox translate y*2.5}
        object{LongBox rotate z*-90 translate <1.25,1.25,0>}
        object{LongBox rotate z*-90 translate
<-1.25,1.25,0>}
       
        rotate z*45
        scale<0.25,0.25,1>
        
       }                    

  union{
        #local Accross=0;
        #local MoveIt=0.875;
        
        #while(Accross<HHorizontal)
  
          #local UpDown=0;
  
          #while(UpDown<VVertical)           
            object{LaticePiece translate <Accross,UpDown,0>}
            #local UpDown=UpDown+MoveIt;
          #end    
      
          #local Accross=Accross+MoveIt;

        #end //End of outer While.
        
        texture{LaticeTexture}      
        translate<-(HHorizontal/2),-(VVertical/2),0>
       } //End of union.

#end  //End of macro. 




-- 
Cheers
Steve              email mailto:sjl### [at] ndirectcouk

%HAV-A-NICEDAY Error not enough coffee  0 pps. 

web http://www.ndirect.co.uk/~sjlen/

or  http://start.at/zero-pps


Post a reply to this message

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