Class: DYI::Shape::Path::ShorthandCurveCommand

Inherits:
CurveCommand show all
Defined in:
lib/dyi/shape/path.rb

Overview

Since:

  • 0.0.0

Instance Attribute Summary

Attributes inherited from CommandBase

#point, #preceding_command

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CurveCommand

#preceding_control_point

Methods inherited from CurveCommandBase

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?

Constructor Details

This class inherits a constructor from DYI::Shape::Path::CurveCommandBase

Class Method Details

.pt_cntObject

Since:

  • 0.0.0



883
884
885
# File 'lib/dyi/shape/path.rb', line 883

def pt_cnt
  2
end

Instance Method Details

#control_point1Object

Since:

  • 0.0.0



862
863
864
865
866
867
868
# File 'lib/dyi/shape/path.rb', line 862

def control_point1
  if relative?
    preceding_point - preceding_control_point
  else
    preceding_point * 2 - preceding_control_point
  end
end

#control_point2Object

Since:

  • 0.0.0



870
871
872
# File 'lib/dyi/shape/path.rb', line 870

def control_point2
  @control_points[0]
end

#instructions_charObject

Since:

  • 0.0.0



878
879
880
# File 'lib/dyi/shape/path.rb', line 878

def instructions_char
  relative? ? 's' : 'S'
end

#to_compatible_commands(preceding_command) ⇒ Object

Since:

  • 0.0.0



874
875
876
# File 'lib/dyi/shape/path.rb', line 874

def to_compatible_commands(preceding_command)
  CurveCommand.new(relative?, preceding_command, control_point1, control_point2, @point)
end