Method: Processing::GraphicsContext#norm

Defined in:
lib/processing/graphics_context.rb

#norm(value, start, stop) ⇒ Numeric

Normalize the value from range start..stop into 0..1.

Parameters:

  • value (Numeric)

    number to be normalized

  • start (Numeric)

    lower bound of the range

  • stop (Numeric)

    upper bound of the range

Returns:

  • (Numeric)

    normalized value between 0..1



1384
1385
1386
# File 'lib/processing/graphics_context.rb', line 1384

def norm(value, start, stop)
  (value.to_f - start.to_f) / (stop.to_f - start.to_f)
end