Class: TerminalVis::Interpolation::DataPoint
- Inherits:
-
Object
- Object
- TerminalVis::Interpolation::DataPoint
- Defined in:
- lib/math/interpolation.rb
Overview
This class represents of a two dimensional point with a numeric value
Instance Attribute Summary collapse
-
#coordinate ⇒ Vector
readonly
2 dimensional coordinates of the data point.
-
#value ⇒ Float
Data value at point(x,y).
Instance Method Summary collapse
-
#initialize(x = 0.0, y = 0.0, value = 0.0) ⇒ DataPoint
constructor
initialization.
-
#x ⇒ Float
helper method to return the x coordinate.
-
#y ⇒ Float
helper method to return the y coordinate.
Constructor Details
#initialize(x = 0.0, y = 0.0, value = 0.0) ⇒ DataPoint
initialization
89 90 91 92 |
# File 'lib/math/interpolation.rb', line 89 def initialize(x=0.0, y=0.0, value=0.0) @coordinate = Vector[x,y] @value = value end |
Instance Attribute Details
#coordinate ⇒ Vector (readonly)
Returns 2 dimensional coordinates of the data point.
81 82 83 |
# File 'lib/math/interpolation.rb', line 81 def coordinate @coordinate end |
#value ⇒ Float
Returns data value at point(x,y).
83 84 85 |
# File 'lib/math/interpolation.rb', line 83 def value @value end |
Instance Method Details
#x ⇒ Float
helper method to return the x coordinate
96 97 98 |
# File 'lib/math/interpolation.rb', line 96 def x @coordinate[0] end |
#y ⇒ Float
helper method to return the y coordinate
102 103 104 |
# File 'lib/math/interpolation.rb', line 102 def y @coordinate[1] end |