Class: SolidRuby::Transformations::Translate
- Inherits:
-
Transformation
- Object
- Transformation
- SolidRuby::Transformations::Translate
- Defined in:
- lib/solidruby/transformations/translate.rb
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
-
#z ⇒ Object
Returns the value of attribute z.
Attributes inherited from Transformation
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Translate
constructor
A new instance of Translate.
- #to_rubyscad ⇒ Object
Methods inherited from Transformation
Constructor Details
#initialize(args = {}) ⇒ Translate
Returns a new instance of Translate.
20 21 22 23 24 25 |
# File 'lib/solidruby/transformations/translate.rb', line 20 def initialize(args={}) super(args) @x = args[:x] || 0 @y = args[:y] || 0 @z = args[:z] || 0 end |
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x.
18 19 20 |
# File 'lib/solidruby/transformations/translate.rb', line 18 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
18 19 20 |
# File 'lib/solidruby/transformations/translate.rb', line 18 def y @y end |
#z ⇒ Object
Returns the value of attribute z.
18 19 20 |
# File 'lib/solidruby/transformations/translate.rb', line 18 def z @z end |
Instance Method Details
#to_rubyscad ⇒ Object
27 28 29 30 31 |
# File 'lib/solidruby/transformations/translate.rb', line 27 def to_rubyscad #ignore empty transformations return '' if @x == 0 && @y == 0 && @z == 0 RubyScadBridge.new.translate({x: @x, y: @y, z: @z}).delete('"') end |