pov ray 3.6 FT shapes try

Alles rund um TX(T) und RoboPro, mit ft-Hard- und Software
Computing using original ft hard- and software
Forumsregeln
Bitte beachte die Forumsregeln!
Antworten
Benutzeravatar
bluatigro
Beiträge: 22
Registriert: 25 Jun 2018, 15:44

pov ray 3.6 FT shapes try

Beitrag von bluatigro » 07 Aug 2018, 16:42

i m for some time Buzzy whit FT in pov ray 3.6
pov ray is a raytracer whitch works whit skripts
and is free of charge
i made the folowing *.pov
please coment on this and if you like this lets expand the number of stones avaleble

Code: Alles auswählen

// bluatigro 7 aug 2018
// fischertechniek test
// some static FT stones and FT humans
// animation wil be added later

#include "colors.inc"
#include "@ft.inc"
camera {
  location < 2 , 2 , -15 >
  look_at < 0 , 4.5 , 0 >
} 
global_settings { ambient_light White } 
light_source { < -100 , 100 , -100 > White * 2 } 
plane { y , 0
  pigment { checker White , White / 2 }
}           
plane { z , 3
  pigment { checker White , White / 2 }
}
sky_sphere {
  pigment {
    gradient y
    color_map {
      [ 0 White ]
      [ 1 Blue ]
    }
    translate < 0 , -.5 , 0 >
    scale 2
  }
}
                    
// scene 1 : some stones                        
object { ft_stone_15( Gray50 )
  translate < -5 , .75 , 0 >
} 
object { ft_stone_30( Gray50 ) 
  translate < -3 , 1.5 , 0 >
} 
object { ft_corner_30 
  translate < 3 , 0 , 0 > 
}
object { ft_corner_60
  translate < 5 , 0 , 0 > 
}
object { ft_naaf    
  rotate < 90 , 0 , 0 >     
  translate < 0 , 1.5 , 0 >
}
object { ft_toothweel( 20 , Red ) 
  rotate < 90 , 0 , 0 >
  translate < 0 , 1.5 , 0 >
}  
object { ft_axel( 5 , 0 ) 
  rotate < 90 , 0 , 0 >
  translate < 0 , 1.5 , -3 >
}  

// scene 2 : some FT humans
/*
object { ft_man( Blue , Yellow , 1 ) 
  translate < -5 , 4 , 0 >
} 
object { ft_man( Blue , Yellow , 0 ) 
  translate < 0 , 4 , 0 >
} 
object { ft_man( White , White , 2 )   
  translate < 5 , 4 , 0 >
} 
*/

Code: Alles auswählen

// bluatigro 7 aug 2018
// @ft.inc
// some FT shapes and FT humans

#include "colors.inc"

#macro ft_plastic( kl )
  pigment { kl } 
  finish { 
    phong .5
    phong_size 100   
    specular .5
  }
#end

#macro ft_stone_30( kl ) 
  union {     
    difference {
      superellipsoid { < .1 , .1 > 
        scale < 1.5 , 3 , 1.5 >
      }   
      box { < -.4 , -2.6 , .7 > , < .4 , -3.1 , 1.6 > } 
      box { < -.4 , -2.6 , -.7 > , < .4 , -3.1 , -1.6 > }
      box { < -.2 , -3.1 , -1 > , < .2 , 3.1 , -1.6 > }   
      box { < -.2 , -3.1 , 1 > , < .2 , 3.1 , 1.6 > }  
      box { < -1.6 , -3.1 , -.2 > , < -1 , 3.1 , .2 > }
      box { < 1.6 , -3.1 , -.2 > , < -1 , 3.1 , .2 > }
      box { < -.2 , -3.1 , -1.6 > , < .2 , -2.6 , 1.6 > }
      cylinder { < 0 , 3.1 , 1.1 > , < 0 , -3.1 , 1.1 > , .4 }
      cylinder { < 0 , 3.1 , -1.1 > , < 0 , -3.1 , -1.1 > , .4 } 
      cylinder { < 1.1 , 3.1 , 0 > , < 1.1 , -3.1 , 0 > , .4 }
      cylinder { < -1.1 , 3.1 , 0 > , < -1.1 , -3.1 , 0 > , .4 }
      cylinder { < 0 , -2.6 , -1.6 > , < 0 , -2.6 , 1.6 > , .4 }
    }
    box { < -.4 , 0 , -.4 > , < .4 , 3.3 , .4 >
      ft_plastic( Black ) 
    } 
    scale .5
    ft_plastic( kl )
  } 
#end

#macro ft_stone_15( kl ) 
  union {     
    difference {
      superellipsoid { < .1 , .1 > 
        scale < 1.5 , 1.5 , 1.5 >
      }   
      box { < -.4 , -1.1 , .7 > , < .4 , -1.6 , 1.6 > } 
      box { < -.4 , -1.1 , -.7 > , < .4 , -1.6 , -1.6 > }
      box { < -.2 , -1.6 , -1 > , < .2 , 1.6 , -1.6 > }   
      box { < -.2 , -1.6 , 1 > , < .2 , 1.6 , 1.6 > }  
      box { < -1.6 , -1.6 , -.2 > , < -1 , 1.6 , .2 > }
      box { < 1.6 , -1.6 , -.2 > , < -1 , 1.6 , .2 > }
      box { < -.2 , -1.6 , -1.6 > , < .2 , -1.1 , 1.6 > }
      cylinder { < 0 , 1.6 , 1.1 > , < 0 , -1.6 , 1.1 > , .4 }
      cylinder { < 0 , 1.6 , -1.1 > , < 0 , -1.6 , -1.1 > , .4 } 
      cylinder { < 1.1 , 1.6 , 0 > , < 1.1 , -1.6 , 0 > , .4 }
      cylinder { < -1.1 , 1.6 , 0 > , < -1.1 , -1.6 , 0 > , .4 }
      cylinder { < 0 , -1.1 , -1.6 > , < 0 , -1.1 , 1.6 > , .4 }
    }
    box { < -.4 , 0 , -.4 > , < .4 , 1.8 , .4 > 
      ft_plastic( Black )
    }
    scale .5
    ft_plastic( kl )
  }   
#end

#macro ft_axel( len , i )
  union { 
    cylinder { < 0 , -len , 0 > , < 0 , len , 0 > , .4 }
    sphere { < 0 , -len , 0 > , .4 }
    sphere { < 0 , len , 0 > , .4 }   
    #if ( i = 0 )
      finish { reflection 1 }
    #end
    #if ( i = 1 )
      ft_plastic( Black )
    #end         
    #if ( i = 2 )
      ft_plastic( rgbf < 1 , 1 , 1 , 1 > )
      interior {
        ior 2
      }
    #end
    scale .5
  }
#end                       

#macro dsin( deg )
  sin( radians( deg ) )
#end                   
#macro dcos( deg )
  cos( radians( deg ) )
#end

#declare ft_corner_60 = union {   
  difference {
    prism {
      linear_sweep
      linear_spline
      -1.5 , 1.5 , 4
      < -1.5 , 0 > , 
      < 0 , dsin( 60 ) * 3 > ,
      < 1.5 , 0 > ,
      < -1.5 , 0 > 
      rotate < -90 , 0 , 0 >
    } 
    box { < -.2 , -.1 , -1.6 > , < .2 , .2 , 1.6 > }
    cylinder { < 0 , .4 , -1.6 > , < 0 , .4 , 1.6 > , .4 } 
  }  
  box { .4 , -.4 
    rotate < 0 , 0 , 60 >
    translate < -dcos( 60 ) * 1.5 
               , dsin( 60 ) * 1.5 , 0 >
  }
  box { .4 , -.4 
    rotate < 0 , 0 , -60 >
    translate < dcos( 60 ) * 1.5 
              , dsin( 60 ) * 1.5 , 0 >
  }         
  scale .5       
  ft_plastic( Red )
} ;

#declare ft_corner_30 = union {   
  difference {
    #local p1x = 1.5 + dsin( 15 ) * .5 ;
    #local p1y = dcos( 15 ) * .5 ;
    #local addx = -dcos( 30 ) * 3 ;
    #local addy = dsin( 30 ) * 3  ;
    #local p2x = p1x + addx ;
    #local p2y = p1y + addy ;
    prism {
      linear_sweep
      linear_spline
      -1.5 , 1.5 , 5
      < -1.5 , 0 > , 
      < p2x , p2y > ,
      < p1x , p1y > ,
      < 1.5 , 0 > ,
      < -1.5 , 0 > 
      rotate < -90 , 0 , 0 >
    } 
    box { < -.2 , -.1 , -1.6 > , < .2 , .2 , 1.6 > }
    cylinder { < 0 , .4 , -1.6 > , < 0 , .4 , 1.6 > , .4 } 
  }  
  box { .4 , -.4 
    rotate < 0 , 0 , 60 >
    translate < dsin( 15 ) * 1.5 , dcos( 15 ) * 1.5 , 0 >
  }       
  scale .5       
  ft_plastic( Red )
} ;              

#declare ft_link = union {
  difference {
    box { -1.5 , 1.5 }
    plane { < -1 , -1 , 0 > , 0 }
    plane { < 1 , -1 , 0 > , 0 }
  }
  cylinder { < 0 , 0 , -1.5 > , < 0 , 0 , 1.5 > , .6 } 
  scale .5
  ft_plastic( Red )   
} ;  

#macro ft_toothweel( tooth , kl )  
  union {          
    cylinder { < 0 , -.4 , 0 > , 
               < 0 , .4 , 0 > , 
               tooth * .15 - .3 }
    #local i = 0 ;
    #while ( i < tooth ) 
      box { < .3 , .4 , .25 > , < -.3 , -.4 , -.25 > 
        translate < tooth * .15 , 0 , 0 >
        rotate < 0 , i * 360 / tooth , 0 >
      }
      #local i = i + 1 ;   
    #end  
    scale .5
    ft_plastic( kl )
  }
#end                                

#declare ft_naaf = union { 
  cylinder { < 0 , -.6 , 0 > , < 0 , .6 , 0 > , 2.5 }
  cone { 0 , 1.5 , < 0 , 1.5 , 0 > , 1 }
  cone { 0 , 1.5 , < 0 , -1.5 , 0 > , 1 }  
  intersection {
    cylinder { < .2 , 0 , 0 > , < -.2 , 0 , 0 > , 2.5 }
    plane { < 0 , 1 , 0 > , 1.5 }
    plane { < 0 , -1 , 0 > , 1.5 }
  }         
  scale .5
  ft_plastic( Red )
} ;               
#declare ft_naaf = union { 
  cylinder { < 0 , -.8 , 0 > , < 0 , .8 , 0 > , 2 }
  cone { 0 , 1 , < 0 , 1.5 , 0 > , .6 }
  cone { 0 , 1 , < 0 , -1.5 , 0 > , .6 }
  cylinder { < .2 , 0 , 0 > , < -.2 , 0 , 0 > , 1.5 }
  scale .5
  ft_plastic( Red )
} ;

#macro ft_foot( kl )                
  difference {
    union {
      #local p1 = < .65 , 2 > ;
      #local p2 = < .65 , 1.7 > ;
      #local p3 = < .35 , 1.4 > ;
      #local p4 = < .35 , 0 > ;
      #local p5 = < -.35 , 0 > ;
      #local p6 = < -.35 , 2 > ;
      prism {
        -.4 , .4 , 7
        p1 , p2 , p3 , p4 , p5 , p6 , p1
        rotate < 90 , 0 , 0 >
        rotate < 0 , 90 , 0 >
      }                      
      cylinder {
        < -.4 , 0 , 0 > , < .4 , 0 , 0 > , .35
      }
      ft_plastic( kl )
    }
    box { < -.15 , -.4 , -.5 > , < .15 , .5 , .5 > }           
  }
#end

#macro ft_leg( kl )
  difference {
    union { 
      #local p1 = < .4 , 0 > ;
      #local p2 = < -.4 , 0 > ;
      #local p3 = < -.35 , 2 > ;
      #local p4 = < .35 , 2 > ;
      prism {
        -.4 , .4 , 5
        p1 , p2 , p3 , p4 , p1
        rotate < 90 , 0 , 0 >
        rotate < 0 , 90 , 0 >
      }                    
      cylinder {
        < -.4 , 0 , 0 > , < .4 , 0 , 0 > , .4
      }
      cylinder {
        < -.4 , -2 , 0 > , < .4 , -2 , 0 > , .35
      }  
    }  
    box { < -.15 , -1.6 , -.5 > , 
          < -.5 , -2.5 , .5 > 
    }
    box { < .15 , -1.6 , -.5 > , 
          < .5 , -2.5 , .5 > 
    }
    ft_plastic( kl )
  }
#end         

#macro ft_body( kl )
  difference {
    union {
      box { 
        < -1 , 0 , -.4 > , < 1 , 2.5 , .4 >
      }
      cylinder {
        < -1 , 0 , 0 > , < 1 , 0 , 0 > , .4
      }
      cylinder {
        < -1 , 2.5 , 0 > , < 1 , 2.5 , 0 > , .4
      }
    }  
    box {
      < -1.1 , -.5 , -.5 > , < -.2 , .4 , .5 >
    }
    box {
      < 1.1 , -.5 , -.5 > , < .2 , .4 , .5 >
    } 
    box {
      < -.5 , 2.5 , -.5 > , < .5 , 3.1 , .5 >
    }
    cylinder {
      < 0 , 2.5 , -.5 > , < 0 , 2.5 , .5 > , .5     
    }   
    ft_plastic( kl )
  }
#end          

#macro ft_head( kl )
  union {            
    superellipsoid {
      < 1 , .1 >  
      scale .75              
      rotate < 90 , 0 , 0 >
      translate < 0 , 1.5 , 0 > 
    }
    cylinder {
      0 , < 0 , 1 , 0 > , .5
    }
    sphere { 0 , .5 } 
    ft_plastic( kl )     
  }
#end          
                 
#macro ft_arm( kl )
  difference {
    union { 
      #local p1 = < .4 , 0 > ;
      #local p2 = < -.4 , 0 > ;
      #local p3 = < -.35 , 1.5 > ;
      #local p4 = < .35 , 1.5 > ;
      prism {
        -.4 , .4 , 5
        p1 , p2 , p3 , p4 , p1
        rotate < 90 , 0 , 0 >
        rotate < 0 , 90 , 0 >
      }                    
      cylinder {
        < -.4 , 0 , 0 > , < .4 , 0 , 0 > , .4
      }
      cylinder {
        < -.4 , -1.5 , 0 > , < .4 , -1.5 , 0 > , .35
      }  
    }  
    box { < -.15 , -1.1 , -.5 > , 
          < -.5 , -1.6 , .5 > 
    }
    box { < .15 , -1.1 , -.5 > , 
          < .5 , -1.6 , .5 > 
    }
    ft_plastic( kl )
  } 
#end

#macro ft_elbow( kl )
  difference {
    union { 
      #local p1 = < .35 , 0 > ;
      #local p2 = < -.35 , 0 > ;
      #local p3 = < -.3 , 1.2 > ;
      #local p4 = < .3 , 1.2 > ;
      prism {
        -.4 , .4 , 5
        p1 , p2 , p3 , p4 , p1
        rotate < 90 , 0 , 0 >
        rotate < 0 , 90 , 0 >
      }                    
      cylinder {
        < -.4 , 0 , 0 > , < .4 , 0 , 0 > , .35
      }
    }  
    box { < -.15 , 1 , -.5 > , 
          < .15 , -.4 , .5 > 
    }
    ft_plastic( kl )
  }                                   
#end           

#macro ft_hand( kl )
  difference {
    union {         
      cylinder {
        < 0 , 1 , 0 > , < 0 , 0 , 0 > , .25
      }                                    
      sphere {
        < 0 , 0 , 0 > , .6
      }
    }                      
    cylinder {
      < 1 , 0  , 0 > , < -1 , 0 , 0 > , .4
    }                                       
    box {
      < 1 , .3 , 0 > , < -1 , -.3 , -1 >
    }
    ft_plastic( kl )
  }
#end

#macro ft_helm( kl )
  difference {
    union {
      sphere { 0 , .85 }
      cylinder { 
        < 0 , 0 , -.4 > , < 0 , .2 , -.4 > , 1
      }
    }   
    box { < 2 , 0 , 2 > , -2 }
    ft_plastic( kl )
  }     
#end  

#macro ft_helm2( kl )    
  #difference {
    union {
      sphere { 0 , .85 }
      cylinder {
        0 , < 0 , -1 > , .85
      }
    }
    cylinder { 
      < -1 , -.4 , -1 > , < 1 , -.4 , -1 > , .5  
    }                                          
    ft_plastic( kl )
  }
#end

#macro ft_man( kl_lijf , kl_helm , helm )
  union {
    object { ft_body(  kl_lijf ) }
    union {
      object { ft_leg( kl_lijf ) }
      union {
        object { ft_foot( Gray25 ) }
        translate < 0 , -2 , 0 >    
      }    
      translate < -.6 , 0 , 0 > 
    }
    union {
      object { ft_leg( kl_lijf ) }
      union {
        object { ft_foot( Gray25 ) }
        translate < 0 , -2 , 0 >     
      }    
      translate < .6 , 0 , 0 > 
    }               
    union {
      object { ft_arm( kl_lijf ) }
      union {
        object { ft_elbow( kl_lijf ) }
        union {
          object { ft_hand( Orange ) }
          translate < 0 , -2 , 0 >    
        }
        translate < 0 , -1.5 , 0 > 
      }
      translate < -1.5 , 2.5 , 0 >   
    }
    union {
      object { ft_arm( kl_lijf ) }
      union {
        object { ft_elbow( kl_lijf ) }
        union {
          object { ft_hand( Orange ) } 
          translate < 0 , -2 , 0 >
        }
        translate < 0 , -1.5 , 0 >
      }
      translate < 1.5 , 2.5 , 0 >
    }
    union {
      object { ft_head( Orange ) }  
      union {                    
        #if ( helm = 1 ) 
          object { ft_helm( kl_helm ) }
        #end                           
        #if ( helm = 2 )
          object { ft_helm2( kl_helm ) }
        #end
        translate < 0 , 2 , 0 >
      }  
      translate < 0 , 2.5 , 0 >  
    }
  }
#end                                

Code: Alles auswählen

// bluatigro 7 aug 2018
// @basis-3d.pov : 3d engine

#declare limmax = 200 ; 
#declare leftno = 0 ; 
#declare rightno = limmax / 2 ;
#declare sk = array[ limmax ][ 3 ]
#declare i = 0 ;
#while ( i < limmax )  
  #declare j = 0 ;
  #while ( j < 3 ) 
    #declare sk[ i ][ j ] = 0 ;
    #declare j = j + 1 ;
  #end
  #declare i = i + 1 ;
#end
#declare xyz = 0 ;
#declare xzy = 1 ;
#declare yxz = 2 ;
#declare yzx = 3 ;
#declare zxy = 4 ;
#declare zyx = 6 ;

#macro link( a , b , c , pan , tilt , rol , q )
  #switch( q )
    #case( xyz )
      rotate < tilt , 0 , 0 >
      rotate < 0 , pan , 0 >
      rotate < 0 , 0 , rol >
    #break
    #case( xzy )
      rotate < tilt , 0 , 0 >
      rotate < 0 , 0 , rol >
      rotate < 0 , pan ,  >  
    #break
    #case( yxz )
      rotate < tilt , 0 , 0 >
      rotate < 0 , pan , 0 >
      rotate < 0 , 0 , rol >
    #break
    #case( yzx )
      rotate < 0 , pan , 0 >
      rotate < 0 , 0 , rol >
      rotate < tilt , 0 , 0 >
    #break
    #case( zxy )
      rotate < 0 , 0 , rol >
      rotate < tilt , 0 , 0 >
      rotate < 0 , pan , 0 >
    #break
    #case( zyx )
      rotate < 0 , 0 , rol >
      rotate < 0 , pan , 0 >
      rotate < tilt , 0 , 0 >
    #break
    #else
    #break
  #end
  translate < a , b , c >  
#end     
#macro child( a , b , c , lim , p )  
  #if ( lim < 0 )
    #declare lim = limmax - lim ;
  #end  
  #if ( ( 0 <= lim ) & ( lim < limmax ) )
    link( a , b , c , 
      sk[ lim ][ 1 ] , 
      sk[ lim ][ 0 ] , 
      sk[ lim ][ 2 ] , p )
  #end
#end    

#macro setangle( lim , a , b , c )  
  #if ( lim < 0 )
    #declare lim = limmax - lim ;
  #end  
  #if ( 0 <= lim )
    #declare sk[ lim ][ 0 ] = a ;
    #declare sk[ lim ][ 1 ] = b ;
    #declare sk[ lim ][ 2 ] = c ;
  #end
#end                                          

#macro pend( fase , amp )                                   
  sin( radians( fase ) ) * amp
#end

#declare thumb  = 1 ;
#declare index  = 4 ;
#declare middle = 7 ;
#declare ring   = 10 ;
#declare pinkie = 13 ;

#declare body   = 20 ;
#declare leg    = 21 ;
#declare knee   = 22 ;
#declare enkle  = 23 ;
#declare arm    = 24 ;
#declare elbow  = 25 ;
#declare wrist  = 26 ;
#declare neck   = 27 ;
#declare eye    = 28 ;
#declare lid    = 29 ;
#declare brouw  = 30 ;
#declare mouth  = 31 ;
#declare tail   = 32 ;

#declare ibody   = 1 ;
#declare ileg    = 2 ;
#declare iknee   = 7 ;
#declare itail   = 12 ;
#declare iarm    = 13 ;
#declare ielbow  = 14 ;
#declare iwrist  = 15 ;
#declare ifinger = 16 ;
#declare ieye    = 17 ;
#declare ilid    = 18 ;
#declare ineck   = 19 ;   
#declare iwing   = 21 ;


Antworten