Class: XYP::Point
- Inherits:
-
Struct
- Object
- Struct
- XYP::Point
- Defined in:
- lib/xyp/plot.rb
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x
21 22 23 |
# File 'lib/xyp/plot.rb', line 21 def x @x end |
#y ⇒ Object
Returns the value of attribute y
21 22 23 |
# File 'lib/xyp/plot.rb', line 21 def y @y end |
Instance Method Details
#+(other) ⇒ Object
26 27 28 |
# File 'lib/xyp/plot.rb', line 26 def +(other) Point.new(self.x+other.x,self.y+other.y) end |
#-(other) ⇒ Object
22 23 24 |
# File 'lib/xyp/plot.rb', line 22 def -(other) Point.new(self.x-other.x,self.y-other.y) end |
#to_a ⇒ Object
34 35 36 |
# File 'lib/xyp/plot.rb', line 34 def to_a [x,y] end |
#to_i ⇒ Object
30 31 32 |
# File 'lib/xyp/plot.rb', line 30 def to_i Point.new(x.to_i,y.to_i) end |