Class: DYI::Shape::Path::QuadraticCurveCommand
Overview
Instance Attribute Summary
Attributes inherited from CommandBase
#point, #preceding_command
Class Method Summary
collapse
Instance Method Summary
collapse
commands, #initialize, #last_control_point, #to_concise_syntax_fragments
Methods inherited from CommandBase
#absolute?, absolute_commands, #initialize, #last_point, #preceding_point, #relative?, relative_commands, #start_point, #used_same_command?
Class Method Details
.pt_cnt ⇒ Object
913
914
915
|
# File 'lib/dyi/shape/path.rb', line 913
def pt_cnt
2
end
|
Instance Method Details
#control_point ⇒ Object
898
899
900
|
# File 'lib/dyi/shape/path.rb', line 898
def control_point
@control_points[0]
end
|
#instructions_char ⇒ Object
908
909
910
|
# File 'lib/dyi/shape/path.rb', line 908
def instructions_char
relative? ? 'q' : 'Q'
end
|
#preceding_control_point ⇒ Object
890
891
892
893
894
895
896
|
# File 'lib/dyi/shape/path.rb', line 890
def preceding_control_point
if preceding_command.is_a?(QuadraticCurveCommand)
preceding_command.last_control_point
else
preceding_command.last_point
end
end
|
#to_compatible_commands(preceding_command) ⇒ Object
902
903
904
905
906
|
# File 'lib/dyi/shape/path.rb', line 902
def to_compatible_commands(preceding_command)
ctrl_pt1 = relative? ? control_point * 2.0 / 3.0 : (preceding_point + control_point * 2.0) / 3.0
ctrl_pt2 = (control_point * 2.0 + point) / 3.0
CurveCommand.new(relative?, preceding_command, ctrl_pt1, ctrl_pt2, @point)
end
|