|
|
One day I needed some gears in my scene, so I created a gear macro. I want
to share it with you great folks. I hope to post some new macros soon, as
I'm reading about gear theory and formulas.
Regards
Werner Vesteraas
Oslo, Norway
---
#version 3.6;
global_settings {
assumed_gamma 1.0
}
// ----------------------------------------
camera {
location <-1, 1, -1>
look_at <0.0, 0.0, 0.0>
}
light_source {
<0, 0, 0> // light's position (translated below)
color rgb <1, 1, 1> // light's color
translate <-30, 30, -60>
}
#macro Gear(NumTeeth, Diameter, Thickness)
#macro Tooth()
prism {
linear_sweep
linear_spline
-1,
1,
7,
<-1, -1.5>,
<-1, 0>,
<-0.5, 1>,
<0.5, 1>,
<1, 0>,
<1, -1.5>,
<-1, -1.5>
rotate -90 * x
scale 0.5
}
#end
union {
union {
#declare T=NumTeeth;
#declare A=0;
#while (A < 360)
object {
Tooth()
translate <0, T / pi, 0>
rotate z * A
}
#declare A = A + 360 / T;
#end
scale 1 / (T / pi)
}
cylinder {
<0, 0, -(1 / (T / pi) / 2)>,
<0, 0, (1 / (T / pi) / 2)>,
1 - (1 / (T / pi) / 2)
}
scale <0.5 * Diameter, 0.5 * Diameter, (T / pi) * 2 * Thickness>
}
#end
object {
Gear(84, 0.867, 0.01)
pigment { color rgb <1, 1, 1> }
}
object {
Gear(7, 0.0848, 0.05)
pigment { color rgb <1, 1, 1> }
}
Post a reply to this message
|
|