Method: OpenC3::SegmentedPolynomialConversion#call
- Defined in:
- lib/openc3/conversions/segmented_polynomial_conversion.rb
#call(value, packet, buffer) ⇒ Float
Returns The value with the polynomial applied.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/openc3/conversions/segmented_polynomial_conversion.rb', line 116 def call(value, packet, buffer) # Try to find correct segment @segments.each do |segment| return segment.calculate(value) if value >= segment.lower_bound end # Default to using segment with smallest lower_bound segment = @segments[-1] if segment return @segments[-1].calculate(value) else return nil end end |