// File: bottle.inc // Vers: 3.1 // Desc: Parameterized bottle include // Date: Nov 6, 1999 // Auth: Paul Hewson /*------------------------------------------------------------------------------------- The macro takes the following parameters NH The neck height NR The neck radius SH The shoulder height (the shoulder is the curved piece that joins body to neck) UDPx User defined point x UDPy User defined point y These allow you to pull the shoulder into different shapes by adding a point to the lathe. BH The height of the body cylinder BR The radius of the body Glass_Texture I found I had to add the texture to each component, because the normal would interfere otherwise. If someone sees a better way, please let me know. =========================================================================================*/ #macro Bottle_Macro (NH, NR, SH, UDPx, UDPy, BH, BR, Glass_Texture) #declare Glass_Thickness = .15; // Neck parameters #declare Neck_Height = NH; #declare Neck_Radius = NR; // Shoulder parameters // // Shoulder is a lathe object with end points joining the neck to body #declare Shoulder_Height = SH; #declare p1x = UDPx; #declare p1y = UDPy; // #declare p2 = // Body parameters #declare Body_Height = BH; #declare Body_Radius = BR; // Base parameters #declare Base_Torus_Radius = .15 // Textures inner and outer #declare Bottle_Texture = texture { Glass_Texture } #declare Bottle_interior = interior { I_Glass } #declare Bottle_Normal = normal {radial frequency 2 scale 3 } // #declare <>; // Base #declare Base = merge { torus { Body_Radius - Base_Torus_Radius , // Base_Torus_Radius // Minor // pigment {rgbt 1} } intersection { cylinder { <0,0,0> // base point <0,Base_Torus_Radius*2 + Glass_Thickness*2,0> // Cap Base_Torus_Radius*2 + Glass_Thickness*2 Body_Radius } difference { sphere { <0,0,0> , 1 scale } sphere { <0,0,0> , 1 scale } } // } // End of intersection texture {Bottle_Texture} interior {Bottle_interior} } // End of merge // Body #declare Body = difference { cylinder { <0,0,0> // Base <0, Body_Height, 0> Body_Radius texture {Bottle_Texture} interior {Bottle_interior} } cylinder { <0,-0.1,0> // Base <0, Body_Height+ .1, 0> Body_Radius - Glass_Thickness texture {Bottle_Texture} normal{Bottle_Normal} } } // Shoulder-------------------------------------------- #declare Shoulder = merge { lathe { cubic_spline 5 // Control point // End point meets body // User defined point // End point meets neck // Control point texture {Bottle_Texture} interior {Bottle_interior} } lathe { cubic_spline 5 // Control point // End point meets body // User defined point // End point meets neck // Control point texture {Bottle_Texture} // interior {Bottle_interior} //normal{Bottle_Normal} } } // End of difference // End of Shoulder-------------------------------------------- // Neck #declare Neck = difference { cylinder { <0,Shoulder_Height + Body_Height,0> //Base <0, Neck_Height + Shoulder_Height + Body_Height, 0> Neck_Radius texture {Bottle_Texture} interior {Bottle_interior} } cylinder { <0,Shoulder_Height + Body_Height - 0.1,0> //Base <0, Neck_Height + Shoulder_Height + Body_Height + .1, 0> Neck_Radius - Glass_Thickness texture {Bottle_Texture} //interior {Bottle_interior} normal{Bottle_Normal} } } //Lip #declare Lip = difference { cylinder { <0, Shoulder_Height + Body_Height + Neck_Height - .2, 0> //Base <0, Shoulder_Height + Body_Height + Neck_Height, 0> Neck_Radius + .1 } cylinder { <0, Shoulder_Height + Body_Height + Neck_Height - .21, 0> //Base <0, Shoulder_Height + Body_Height + Neck_Height+ .01, 0> Neck_Radius - Glass_Thickness } texture {Bottle_Texture} interior {Bottle_interior} } // #declare Bottle = object { union { merge { object {Base} object {Body} object {Neck} object {Lip} object {Shoulder} } } } #end