//-----------------------------------------
#macro Glass_01( G_R, // radius of glass
G_H, // height of glass
Merge_Flag//0=union;1=merge
) //------------------------
#if (Merge_Flag = 1)
merge{
#else
union{
#end // von "#if"
difference{
cylinder{<0, 0,0>,<0,G_H ,0>,G_R }
cylinder{<0,G_R*.05,0>,<0,G_H+.1,0>,G_R*.9}
} // end of difference
torus{ G_R*0.95, G_R*0.05
translate<0,G_H,0> }
} //end of union
#end // end of macro
//-----------------------------------------
//-----------------------------------------
global_settings{max_trace_level 10}
//-----------------------------------------
object{ Glass_01( 0.35, // radius of glass
0.90, // height of glass
0 // Merge_Flag
) //-----------------------
texture{
pigment{ color rgb<1,0.95,0.9>}
finish { phong 1 reflection 0.05}
} // end of texture
translate<-0.5,0,-0.5>
} //---------------------------------
object{ Glass_01( 0.35, // radius of glass
0.90, // height of glass
1 // Merge_Flag
) //-----------------------
material{
texture{
pigment{ rgbf<.98,.98,.98,0.9>}
finish { diffuse 0.1
reflection 0.2
specular .8
roughness .0003
phong 1 phong_size 400}
} // end of texture
interior{ ior 1.5 caustics 0.5
} // end of interior
} // end of material
translate< 0.5,0,-0.5>
} //--------------------------------- |
Note: "merge" works similar as "union". In addition it removes
all surface which are inside the combined shapes. Because of this with transparent materials
there will be neither reflection nor refraction at these inner surfaces
- the shape looks like made in one casting.
If there are many of such "inner" surfaces this additional calculations can
dramatically more time than a simple union. Because of this we should always use "union"
for combined shapes if the shapes are not transparent.
|