|
|
//================================================
// Little horn macro by Gilles Tran CopyIfYouWant 1999
// This one makes a couple of horns based on spheres
// The horns have a slight bulge at the base
// but otherwise they look nice
// To find somebody to put these horns on
// may prove more difficult.
//================================================
// hradius_start = horn radius at start
// hradius_end = horn radius at the end (0= very pointy horn)
// hsize = of length of horn if straight
// hangle = how much the horn is curved
// hinter=interval between horns
// n = nb of horn elements
//================================================
// the horns are in the x-y plane
//================================================
#macro mHorns(hradius_start,hradius_end,hsize,hangle,hinter,n)
//#local hcol_start=Yellow*0.5; // start color - uncomment if you want a
gradient pigment
//#local hcol_end=Black; // end color
#local OneHorn=
union{
#local lseg=pi*hsize/n;
#local i=0;
#local r1=hradius_start;
#local P=<0,0,0>;
#while (i<=n)
#local r = hradius_start + (hradius_end -
hradius_start)*i/n;
sphere{P,r
// uncomment the following line if you want a gradient
pigment
// texture{pigment{hcol_start + (hcol_end -
hcol_start)*i/n} finish{ambient 1 specular 1 roughness 0.05}}
}
#if(i=0) #local P=x*lseg; #else #local
P=P+lseg*(vnormalize(vrotate(P,z*hangle*i/n)));#end
#local i=i+1;
#end
}
union{
object{OneHorn translate x*hinter*0.5}
object{OneHorn translate x*hinter*0.5 scale <-1,1,1>}
}
#end
//================================================
// examples
//================================================
#include "colors.inc"
camera{location <1.0, 5, -30.0> direction 1.5*z right 4/3*x look_at
<0.0, 5, 0.0>}
light_source{<-30, 30, -30> color Cyan}
light_source{<30, 30, -30> color White*2}
// crossed horns (hangle=120)
//object{mHorns(2,0.2,5,120,5,200) texture{pigment{rgb<1,0.7,0.3>}
finish{metallic brilliance 5 ambient 0.01 phong 1}}}
// closed horns (hangle=90)
object{mHorns(2,0.2,5,90,5,200) texture{pigment{rgb<1,0.7,0.3>}
finish{metallic brilliance 5 ambient 0.01 phong 1}}}
// open horns (hangle=40)
//object{mHorns(2,0.2,5,40,5,200) texture{pigment{rgb<1,0.7,0.3>}
finish{metallic brilliance 5 ambient 0.01 phong 1}}}
background{White}
Post a reply to this message
|
|