Class: Polylabel::Cell
- Inherits:
-
Object
- Object
- Polylabel::Cell
- Defined in:
- lib/polylabel/cell.rb
Instance Attribute Summary collapse
-
#d ⇒ Object
readonly
Returns the value of attribute d.
-
#h ⇒ Object
readonly
Returns the value of attribute h.
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(x, y, h, polygon) ⇒ Cell
constructor
A new instance of Cell.
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
#d ⇒ Object (readonly)
Returns the value of attribute d.
3 4 5 |
# File 'lib/polylabel/cell.rb', line 3 def d @d end |
#h ⇒ Object (readonly)
Returns the value of attribute h.
3 4 5 |
# File 'lib/polylabel/cell.rb', line 3 def h @h end |
#max ⇒ Object (readonly)
Returns the value of attribute max.
3 4 5 |
# File 'lib/polylabel/cell.rb', line 3 def max @max end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
3 4 5 |
# File 'lib/polylabel/cell.rb', line 3 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
3 4 5 |
# File 'lib/polylabel/cell.rb', line 3 def y @y end |