Class: Clef::Notation::Tie
- Inherits:
-
Object
- Object
- Clef::Notation::Tie
- Defined in:
- lib/clef/notation/tie.rb
Instance Attribute Summary collapse
-
#end_note ⇒ Object
readonly
Returns the value of attribute end_note.
-
#start_note ⇒ Object
readonly
Returns the value of attribute start_note.
Instance Method Summary collapse
- #control_points(start_point, end_point) ⇒ Array<Array<Float>>
-
#initialize(start_note, end_note) ⇒ Tie
constructor
A new instance of Tie.
Constructor Details
#initialize(start_note, end_note) ⇒ Tie
Returns a new instance of Tie.
10 11 12 13 14 15 |
# File 'lib/clef/notation/tie.rb', line 10 def initialize(start_note, end_note) raise ArgumentError, "tie requires notes with same pitch" unless start_note.pitch.enharmonic?(end_note.pitch) @start_note = start_note @end_note = end_note end |
Instance Attribute Details
#end_note ⇒ Object (readonly)
Returns the value of attribute end_note.
6 7 8 |
# File 'lib/clef/notation/tie.rb', line 6 def end_note @end_note end |
#start_note ⇒ Object (readonly)
Returns the value of attribute start_note.
6 7 8 |
# File 'lib/clef/notation/tie.rb', line 6 def start_note @start_note end |
Instance Method Details
#control_points(start_point, end_point) ⇒ Array<Array<Float>>
20 21 22 23 24 25 26 27 |
# File 'lib/clef/notation/tie.rb', line 20 def control_points(start_point, end_point) midpoint_x = (start_point[0] + end_point[0]) / 2.0 lift = [((end_point[0] - start_point[0]).abs / 8.0), 3.0].max [ [midpoint_x - 6, start_point[1] - lift], [midpoint_x + 6, end_point[1] - lift] ] end |