Class: Laser::Cutter::Notching::Shift
- Inherits:
-
Struct
- Object
- Struct
- Laser::Cutter::Notching::Shift
- Defined in:
- lib/laser/cutter/notching/shift.rb
Overview
One step of a notched path: delta along one axis, x (0) or y (1), forwards (1) or backwards (-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
-
#next_point_after(point) ⇒ Geometry::Point
The point one step on.
Instance Attribute Details
#delta ⇒ Object
Returns the value of attribute delta
8 9 10 |
# File 'lib/laser/cutter/notching/shift.rb', line 8 def delta @delta end |
#dim_index ⇒ Object
Returns the value of attribute dim_index
8 9 10 |
# File 'lib/laser/cutter/notching/shift.rb', line 8 def dim_index @dim_index end |
#direction ⇒ Object
Returns the value of attribute direction
8 9 10 |
# File 'lib/laser/cutter/notching/shift.rb', line 8 def direction @direction end |
Instance Method Details
#next_point_after(point) ⇒ Geometry::Point
Returns the point one step on.
11 12 13 14 15 16 17 |
# File 'lib/laser/cutter/notching/shift.rb', line 11 def next_point_after(point) p = point.clone shift = [] shift[dim_index] = delta * direction shift[(dim_index + 1) % 2] = 0 p.plus(*shift) end |