O'Reilly logo

openFrameworks Essentials by Denis Perevalov, Igor Tatarnikov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mathematical, timer, and conversion functions

The mathematical, timer, and conversion functions were described in Chapter 6, Animating Parameters, and Chapter 7, Distributed and Physical Computing with Networking and Arduino, and are collected in this table:

Function

Description

ofMap( x, 0, 1, 2, 3 )

This linearly maps the float x from segment [0,1] to segment [2,3].

ofMap( x, 0, 1, 2, 3, true )

This linearly maps the float x from the segment [0,1] to the segment [2,3], clamping the output value to the [2,3] range (it occurs when x is not in segment [0,1]).

ofClamp( x, 0, 1 )

This clamps the float x to the range [0,1].

ofInRange( x, 0, 1 )

This returns true if the float x lies in the segment [0,1] and returns false in the opposite ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required