Class: Geometry::Arc
- Inherits:
-
Object
- Object
- Geometry::Arc
- Includes:
- ClusterFactory
- Defined in:
- lib/geometry/arc.rb
Overview
Direct Known Subclasses
Instance Attribute Summary collapse
-
#center ⇒ Object
readonly
Returns the value of attribute center.
-
#end_angle ⇒ Object
readonly
Returns the value of attribute end_angle.
- #options ⇒ Object
-
#radius ⇒ Object
readonly
Returns the value of attribute radius.
-
#start_angle ⇒ Object
readonly
Returns the value of attribute start_angle.
Class Method Summary collapse
Instance Method Summary collapse
-
#first ⇒ Point
The starting point of the Arc.
-
#initialize(center, radius, start_angle, end_angle) ⇒ Arc
constructor
Construct a new Arc.
-
#last ⇒ Point
The end point of the Arc.
Methods included from ClusterFactory
Constructor Details
#initialize(center, radius, start_angle, end_angle) ⇒ Arc
Construct a new Geometry::Arc
57 58 59 60 61 62 |
# File 'lib/geometry/arc.rb', line 57 def initialize(center, radius, start_angle, end_angle) @center = Point[center] @radius = radius @start_angle = start_angle @end_angle = end_angle end |
Instance Attribute Details
#center ⇒ Object (readonly)
Returns the value of attribute center.
19 20 21 |
# File 'lib/geometry/arc.rb', line 19 def center @center end |
#end_angle ⇒ Object (readonly)
Returns the value of attribute end_angle.
21 22 23 |
# File 'lib/geometry/arc.rb', line 21 def end_angle @end_angle end |
#options ⇒ Object
23 24 25 26 |
# File 'lib/geometry/arc.rb', line 23 def @options = {} if !@options @options end |
#radius ⇒ Object (readonly)
Returns the value of attribute radius.
20 21 22 |
# File 'lib/geometry/arc.rb', line 20 def radius @radius end |
#start_angle ⇒ Object (readonly)
Returns the value of attribute start_angle.
21 22 23 |
# File 'lib/geometry/arc.rb', line 21 def start_angle @start_angle end |
Class Method Details
.new(center, start, end) ⇒ Arc, ThreePointArc .new(center, radius, start, end) ⇒ Arc, ThreePointArc
41 42 43 44 45 46 47 48 49 |
# File 'lib/geometry/arc.rb', line 41 def self.new(={}) center = .delete(:center) || PointZero.new if .has_key?(:radius) original_new(center, [:radius], [:start], [:end]) else ThreePointArc.new(center, [:start], [:end]) end end |