Class: Terraformer::Circle
- Inherits:
-
Object
- Object
- Terraformer::Circle
- Extended by:
- Forwardable
- Defined in:
- lib/terraformer/circle.rb
Instance Attribute Summary collapse
-
#center ⇒ Object
Returns the value of attribute center.
-
#polygon ⇒ Object
Returns the value of attribute polygon.
-
#radius ⇒ Object
Returns the value of attribute radius.
-
#resolution ⇒ Object
Returns the value of attribute resolution.
Instance Method Summary collapse
- #dirty? ⇒ Boolean
-
#initialize(c, r, res = DEFAULT_BUFFER_RESOLUTION) ⇒ Circle
constructor
A new instance of Circle.
- #recalculate ⇒ Object
Constructor Details
#initialize(c, r, res = DEFAULT_BUFFER_RESOLUTION) ⇒ Circle
Returns a new instance of Circle.
9 10 11 12 13 14 |
# File 'lib/terraformer/circle.rb', line 9 def initialize c, r, res = DEFAULT_BUFFER_RESOLUTION self.center = c self.radius = r self.resolution = res recalculate end |
Instance Attribute Details
#center ⇒ Object
Returns the value of attribute center.
6 7 8 |
# File 'lib/terraformer/circle.rb', line 6 def center @center end |
#polygon ⇒ Object
Returns the value of attribute polygon.
5 6 7 |
# File 'lib/terraformer/circle.rb', line 5 def polygon @polygon end |
#radius ⇒ Object
Returns the value of attribute radius.
6 7 8 |
# File 'lib/terraformer/circle.rb', line 6 def radius @radius end |
#resolution ⇒ Object
Returns the value of attribute resolution.
6 7 8 |
# File 'lib/terraformer/circle.rb', line 6 def resolution @resolution end |
Instance Method Details
#dirty? ⇒ Boolean
45 46 47 |
# File 'lib/terraformer/circle.rb', line 45 def dirty? @dirty end |
#recalculate ⇒ Object
16 17 18 19 20 |
# File 'lib/terraformer/circle.rb', line 16 def recalculate @polygon = @center.buffer @radius, @resolution @dirty = false self end |