Class: TerminalVis::Interpolation::DataPoint

Inherits:
Object
  • Object
show all
Defined in:
lib/math/interpolation.rb

Overview

This class represents of a two dimensional point with a numeric value

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x = 0.0, y = 0.0, value = 0.0) ⇒ DataPoint

initialization

Parameters:

  • x (Float) (defaults to: 0.0)

    coordinate in first dimension

  • y (Float) (defaults to: 0.0)

    coordinate in second dimension

  • value (Float) (defaults to: 0.0)

    data value at coordinate (x,y)



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

#coordinateVector (readonly)

Returns 2 dimensional coordinates of the data point.

Returns:

  • (Vector)

    2 dimensional coordinates of the data point



81
82
83
# File 'lib/math/interpolation.rb', line 81

def coordinate
  @coordinate
end

#valueFloat

Returns data value at point(x,y).

Returns:

  • (Float)

    data value at point(x,y)



83
84
85
# File 'lib/math/interpolation.rb', line 83

def value
  @value
end

Instance Method Details

#xFloat

helper method to return the x coordinate

Returns:



96
97
98
# File 'lib/math/interpolation.rb', line 96

def x
  @coordinate[0]
end

#yFloat

helper method to return the y coordinate

Returns:



102
103
104
# File 'lib/math/interpolation.rb', line 102

def y
  @coordinate[1]
end