How to Make a Chain
Objects: "sphere", "box", "cylinder".
Methods: "#declare", "union", "difference",
"#while", "#if",.
This sample shows how to construct a chain. It is possible to use variable sizes for all messures of the chain links.
|
|
The Construction in details:
Step 0: Declare the basic messures of the torus used for the link:
#declare R_min = 0.25;
#declare R_maj = 1.00;
#declare Half_L = 0.25; // half linear part!
#declare Link_Length = 2*(R_maj);
Step 1: Define a box containing the right
half of the torus and
subtract this box form the torus:
difference{
torus { R_maj, R_min
rotate <90,0,0>
} // end of torus ------------------
box{< 0,-R_maj-R_min,-R_min>,
< R_maj+R_min, R_maj+R_min, R_min>
}// end of box
}// end of difference
|
|
Step 2: Move the half torus to the left by the half length of the linear part
of the chain link. Then add one (only one!) of this linear parts of the link.
After all declare it as a new object "Left_Half" and mirror this element at <0,0,0>:
#declare Left_Half =
union{
difference{
torus { R_maj, R_min
rotate <90,0,0>
} // end of torus ---------------
box{< 0,-R_maj-R_min,-R_min>,
< R_maj+R_min, R_maj+R_min, R_min>
}// end of box
translate <-Half_L,0,0>
}// end of difference
cylinder {
<-Half_L,0,0>,<Half_L,0,0>, R_min
translate <0,R_maj,0>
} // end of cylinder
}// end of union
//----------------------------------------
#declare Chain_Link =
union{
object{ Left_Half }
object{ Left_Half scale <-1,-1,1>}
texture {pigment{color rgb<1,1,1>*0.2}
normal {bumps 0.125 scale 0.015}
finish {ambient 0.15 diffuse 0.85
phong 0.5 reflection 0.2}
} // end of texture
} // end of Chain_Element
|
|