Class: Ra::Pattern::Base
- Inherits:
-
Object
- Object
- Ra::Pattern::Base
- Defined in:
- lib/ra/pattern/base.rb
Overview
An abstract pattern. Any concrete subclass of pattern must implement the method local_color.
Instance Attribute Summary collapse
-
#transform ⇒ Object
Returns the value of attribute transform.
Instance Method Summary collapse
- #color(point:) ⇒ Ra::Color
-
#initialize(transform: Transform::IDENTITY) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(transform: Transform::IDENTITY) ⇒ Base
Returns a new instance of Base.
11 12 13 |
# File 'lib/ra/pattern/base.rb', line 11 def initialize(transform: Transform::IDENTITY) @transform = transform end |
Instance Attribute Details
#transform ⇒ Object
Returns the value of attribute transform.
8 9 10 |
# File 'lib/ra/pattern/base.rb', line 8 def transform @transform end |
Instance Method Details
#color(point:) ⇒ Ra::Color
17 18 19 20 |
# File 'lib/ra/pattern/base.rb', line 17 def color(point:) local_point = transform.inverse * point local_color(local_point:) end |