Class: Terraformer::Circle

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/terraformer/circle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#centerObject

Returns the value of attribute center.



6
7
8
# File 'lib/terraformer/circle.rb', line 6

def center
  @center
end

#polygonObject

Returns the value of attribute polygon.



5
6
7
# File 'lib/terraformer/circle.rb', line 5

def polygon
  @polygon
end

#radiusObject

Returns the value of attribute radius.



6
7
8
# File 'lib/terraformer/circle.rb', line 6

def radius
  @radius
end

#resolutionObject

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

Returns:

  • (Boolean)


45
46
47
# File 'lib/terraformer/circle.rb', line 45

def dirty?
  @dirty
end

#recalculateObject



16
17
18
19
20
# File 'lib/terraformer/circle.rb', line 16

def recalculate
  @polygon = @center.buffer @radius, @resolution
  @dirty = false
  self
end