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