Class: Seg2D
- Inherits:
-
Struct
- Object
- Struct
- Seg2D
- Defined in:
- lib/cem/cruzzles.rb
Instance Attribute Summary collapse
-
#p1 ⇒ Object
Returns the value of attribute p1.
-
#p2 ⇒ Object
Returns the value of attribute p2.
Instance Method Summary collapse
Instance Attribute Details
#p1 ⇒ Object
Returns the value of attribute p1
185 186 187 |
# File 'lib/cem/cruzzles.rb', line 185 def p1 @p1 end |
#p2 ⇒ Object
Returns the value of attribute p2
185 186 187 |
# File 'lib/cem/cruzzles.rb', line 185 def p2 @p2 end |
Instance Method Details
#to_s ⇒ Object
186 187 188 |
# File 'lib/cem/cruzzles.rb', line 186 def to_s "#{p1},#{p2}" end |
#x_range ⇒ Object
190 191 192 193 194 195 196 |
# File 'lib/cem/cruzzles.rb', line 190 def x_range if p1.x < p2.x return p1.x..p2.x else return p2.x..p1.x end end |
#y_range ⇒ Object
198 199 200 201 202 203 204 |
# File 'lib/cem/cruzzles.rb', line 198 def y_range if p1.y < p2.y return p1.y..p2.y else return p2.y..p1.y end end |