Class: HelicalGear
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#helix_angle ⇒ Object
readonly
Returns the value of attribute helix_angle.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
Instance Method Summary collapse
-
#initialize(pitch_dia, height, helix_angle = Math::PI / 3.0) ⇒ HelicalGear
constructor
A new instance of HelicalGear.
- #twist ⇒ Object
Methods inherited from Shape
#*, #+, #-, #align, #back, #bbox, #bottom, #center, #cx, #cy, #cz, #extrude, #front, #left, #maxx, #maxy, #maxz, #minx, #miny, #minz, #mirror, #mirror_x, #mirror_y, #mirror_z, #move, #move_x, #move_y, #move_z, #render, #revolve, #right, #rot_x, #rot_y, #rot_z, #rotate, #scale, #scale_x, #scale_y, #scale_z, #top, #transform, #xcenter, #xsize, #ycenter, #ysize, #zcenter, #zsize, #~@
Constructor Details
#initialize(pitch_dia, height, helix_angle = Math::PI / 3.0) ⇒ HelicalGear
Returns a new instance of HelicalGear.
114 115 116 117 118 119 120 |
# File 'lib/rcad/gears.rb', line 114 def initialize(pitch_dia, height, helix_angle=Math::PI / 3.0) @height = height @helix_angle = helix_angle @profile = GearProfile.new(pitch_dia) @shape = profile.extrude(height, twist) end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
112 113 114 |
# File 'lib/rcad/gears.rb', line 112 def height @height end |
#helix_angle ⇒ Object (readonly)
Returns the value of attribute helix_angle.
112 113 114 |
# File 'lib/rcad/gears.rb', line 112 def helix_angle @helix_angle end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
112 113 114 |
# File 'lib/rcad/gears.rb', line 112 def profile @profile end |
Instance Method Details
#twist ⇒ Object
122 123 124 125 126 127 |
# File 'lib/rcad/gears.rb', line 122 def twist twist_length = Math::tan(helix_angle) * height pitch_circumference = Math::PI * profile.pitch_dia twist_length * (2 * Math::PI / pitch_circumference) end |