Class: Polylabel::Cell

Inherits:
Object
  • Object
show all
Defined in:
lib/polylabel/cell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, h, polygon) ⇒ Cell

Returns a new instance of Cell.



5
6
7
8
9
10
11
# File 'lib/polylabel/cell.rb', line 5

def initialize(x, y, h, polygon)
  @x = x
  @y = y
  @h = h
  @d = point_to_polygon_dist(x, y, polygon)
  @max = @d + @h * Math.sqrt(2)
end

Instance Attribute Details

#dObject (readonly)

Returns the value of attribute d.



3
4
5
# File 'lib/polylabel/cell.rb', line 3

def d
  @d
end

#hObject (readonly)

Returns the value of attribute h.



3
4
5
# File 'lib/polylabel/cell.rb', line 3

def h
  @h
end

#maxObject (readonly)

Returns the value of attribute max.



3
4
5
# File 'lib/polylabel/cell.rb', line 3

def max
  @max
end

#xObject (readonly)

Returns the value of attribute x.



3
4
5
# File 'lib/polylabel/cell.rb', line 3

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



3
4
5
# File 'lib/polylabel/cell.rb', line 3

def y
  @y
end