Class: DataPoint
- Inherits:
-
Object
- Object
- DataPoint
- Defined in:
- lib/technical_graph/data_point.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(h = { :x => 0, :y => 0 }) ⇒ DataPoint
constructor
A new instance of DataPoint.
- #x ⇒ Object
- #x=(_x) ⇒ Object
- #x_distance(other_dp) ⇒ Object
- #y ⇒ Object
- #y=(_y) ⇒ Object
- #y_distance(other_dp) ⇒ Object
Constructor Details
Class Method Details
Instance Method Details
#x ⇒ Object
26 27 28 |
# File 'lib/technical_graph/data_point.rb', line 26 def x @x end |
#x=(_x) ⇒ Object
34 35 36 |
# File 'lib/technical_graph/data_point.rb', line 34 def x=(_x) @x = _x end |
#x_distance(other_dp) ⇒ Object
18 19 20 |
# File 'lib/technical_graph/data_point.rb', line 18 def x_distance(other_dp) return (self.x - other_dp.x).abs end |
#y ⇒ Object
30 31 32 |
# File 'lib/technical_graph/data_point.rb', line 30 def y @y end |
#y=(_y) ⇒ Object
38 39 40 |
# File 'lib/technical_graph/data_point.rb', line 38 def y=(_y) @y = _y end |
#y_distance(other_dp) ⇒ Object
22 23 24 |
# File 'lib/technical_graph/data_point.rb', line 22 def y_distance(other_dp) return (self.y - other_dp.y).abs end |