Class: Laser::Cutter::Geometry::Shift
- Inherits:
-
Struct
- Object
- Struct
- Laser::Cutter::Geometry::Shift
- Defined in:
- lib/laser-cutter/geometry/path_generator.rb
Constant Summary collapse
- POINTERS =
{[1, 0] => ' ->', [-1, 0] => '<- ', [1, 1] => ' V ', [-1, 1] => ' ^ '}
Instance Attribute Summary collapse
-
#delta ⇒ Object
Returns the value of attribute delta.
-
#dim_index ⇒ Object
Returns the value of attribute dim_index.
-
#direction ⇒ Object
Returns the value of attribute direction.
Instance Method Summary collapse
Instance Attribute Details
#delta ⇒ Object
Returns the value of attribute delta
6 7 8 |
# File 'lib/laser-cutter/geometry/path_generator.rb', line 6 def delta @delta end |
#dim_index ⇒ Object
Returns the value of attribute dim_index
6 7 8 |
# File 'lib/laser-cutter/geometry/path_generator.rb', line 6 def dim_index @dim_index end |
#direction ⇒ Object
Returns the value of attribute direction
6 7 8 |
# File 'lib/laser-cutter/geometry/path_generator.rb', line 6 def direction @direction end |
Instance Method Details
#next(point1) ⇒ Object
12 13 14 15 16 |
# File 'lib/laser-cutter/geometry/path_generator.rb', line 12 def next(point1) p = Point.new(point1.to_a) p.coords[dim_index] += (delta * direction) p end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/laser-cutter/geometry/path_generator.rb', line 17 def to_s "shift by:#{sprintf('%.2f', delta)}, #{POINTERS[[direction,dim_index]]}" end |