Class: Rays::Polyline
- Inherits:
-
Object
- Object
- Rays::Polyline
- Includes:
- Enumerable
- Defined in:
- lib/rays/polyline.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(*points, loop: false) ⇒ Polyline
constructor
A new instance of Polyline.
- #inspect ⇒ Object
- #transform(matrix = nil, loop: loop?, , &block) ⇒ Object
Constructor Details
#initialize(*points, loop: false) ⇒ Polyline
Returns a new instance of Polyline.
11 12 13 |
# File 'lib/rays/polyline.rb', line 11 def initialize(*points, loop: false) setup points, loop end |
Instance Method Details
#inspect ⇒ Object
22 23 24 |
# File 'lib/rays/polyline.rb', line 22 def inspect() "#<Rays::Polyline #{to_a.join ', '}, loop: #{loop?}>" end |
#transform(matrix = nil, loop: loop?, , &block) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/rays/polyline.rb', line 15 def transform(matrix = nil, loop: loop?, &block) points = to_a points = points.map {|point| matrix * point} if matrix points = block.call points if block self.class.new(*points, loop: loop) end |