greenhouse
a creative coding toolkit for spatial interfaces

Math

Commonly used math methods.

  • Abs ()
  • Random ()
  • SeedRandomizer ()
  • Range ()
  • Min ()
  • Max ()
  • Rad ()
  • Deg ()
  • PI
  • sin ()
  • cos ()
  • tan ()

Example

// Simply define WORKER at the top of the file, before including
// "Greenhouse.h", to run a Greenhouse program that is 'headless' --
// no window, no GUI.  Could be used as a background worker, daemon,
// or script.
#define WORKER
#include "Greenhouse.h"

void Setup ()
{ float64 neg = -1.2345;
  float64 pos = Abs (neg);    // 1.2345

  float64 n = Random (3); //  random value between 0 and 3
  n = Random (3, 12.5);   //  random value between 3 and 12.5

  INFORM ("Should be 25: " + ToStr (Range (5, 0, 20, 0, 100)));

  float64 min = Min (PI, 9.25); // 3.14...
  float64 max = Max (PI, 9.25); // 9.25

  float64 s = Rad (180.0); // 3.14...
  float64 d = Deg (PI);    // 180.0
}