Class: Savage::Directions::ArcTo

Inherits:
PointTarget show all
Defined in:
lib/savage/directions/arc_to.rb

Instance Attribute Summary collapse

Attributes inherited from PointTarget

#target

Instance Method Summary collapse

Methods inherited from Savage::Direction

#absolute?, #to_command

Methods included from Utils

#bool_to_int

Constructor Details

#initialize(radius_x, radius_y, rotation, large_arc, sweep, target_x, target_y, absolute = true) ⇒ ArcTo

Returns a new instance of ArcTo.



6
7
8
9
10
11
12
# File 'lib/savage/directions/arc_to.rb', line 6

def initialize(radius_x, radius_y, rotation, large_arc, sweep, target_x, target_y, absolute=true)
  super(target_x, target_y, absolute)
  @radius = Point.new(radius_x, radius_y)
  @rotation = rotation
  @large_arc = large_arc.is_a?(Numeric) ? large_arc > 0 : large_arc
  @sweep = sweep.is_a?(Numeric) ? sweep > 0 : sweep
end

Instance Attribute Details

#large_arcObject

Returns the value of attribute large_arc.



4
5
6
# File 'lib/savage/directions/arc_to.rb', line 4

def large_arc
  @large_arc
end

#radiusObject

Returns the value of attribute radius.



4
5
6
# File 'lib/savage/directions/arc_to.rb', line 4

def radius
  @radius
end

#rotationObject

Returns the value of attribute rotation.



4
5
6
# File 'lib/savage/directions/arc_to.rb', line 4

def rotation
  @rotation
end

#sweepObject

Returns the value of attribute sweep.



4
5
6
# File 'lib/savage/directions/arc_to.rb', line 4

def sweep
  @sweep
end

Instance Method Details

#command_codeObject



18
19
20
# File 'lib/savage/directions/arc_to.rb', line 18

def command_code
  (absolute?) ? 'A' : 'a'
end

#to_aObject



14
15
16
# File 'lib/savage/directions/arc_to.rb', line 14

def to_a
  [command_code, @radius.x, @radius.y, @rotation, bool_to_int(@large_arc), bool_to_int(@sweep), target.x, target.y]
end