Class: Geometry::ThreePointArc

Inherits:
Arc
  • Object
show all
Defined in:
lib/geometry/arc.rb

Instance Attribute Summary collapse

Attributes inherited from Arc

#end_angle, #radius, #start_angle

Instance Method Summary collapse

Methods inherited from Arc

new

Methods included from ClusterFactory

included

Constructor Details

#initialize(center_point, start_point, end_point) ⇒ ThreePointArc

Contruct a new Arc given center, start and end Points

Always assumes that the {Arc} is counter-clockwise. Reverse the order
of the start and end points to get an {Arc} that goes around the other way.

Parameters:

Raises:

  • (ArgumentError)


81
82
83
84
# File 'lib/geometry/arc.rb', line 81

def initialize(center_point, start_point, end_point)
    @center, @start, @end = [center_point, start_point, end_point].map {|p| Point[p]}
    raise ArgumentError unless [@center, @start, @end].all? {|p| p.is_a?(Point)}
end

Instance Attribute Details

#centerObject (readonly)

Returns the value of attribute center.



71
72
73
# File 'lib/geometry/arc.rb', line 71

def center
  @center
end

#endObject (readonly) Also known as: last

Returns the value of attribute end.



72
73
74
# File 'lib/geometry/arc.rb', line 72

def end
  @end
end

#startObject (readonly) Also known as: first

Returns the value of attribute start.



72
73
74
# File 'lib/geometry/arc.rb', line 72

def start
  @start
end