greenhouse
a creative coding toolkit for spatial interfaces

Feld Properties

Physical properties of felds.

  • SetFeldsColor ()
  • Loc ()
  • Over ()
  • Up ()
  • Norm ()
  • Width ()
  • Height ()
  • FeldAspect ()
  • Diag ()
  • Inside ()

Example

#include "Greenhouse.h"

//set the feld color and print out some info about it
//create a Text, Slap on feld and IncTranslation

void Setup ()
{ //set the feld color
  SetFeldsColor (Color ("#A8BBBA"));

  //create a Text and set its translation
  Text *t = new Text ("lefty!");
  t -> SetTranslation (Feld () -> Loc ());
  // shift the text to the left along the feld
  t -> IncTranslation (-0.25 * Feld () -> Width () * Feld () -> Over ());
  // shift the text up along the feld
  t -> IncTranslation (0.25 * Feld () -> Height () * Feld () -> Up ());
  // shift the text to in front of the feld by 10mm
  t -> IncTranslation (10 * Feld () -> Norm ());

  Text *t2 = new Text ("righty!");
  // set the height of the text relative to the Feld's diagonal length
  t2 -> SetFontSize (0.1 * Diag (Feld ()));
  // set the translation to the right and down and just in front of the feld
  t2 -> SetTranslation (Inside (Feld (), Vect (0.25, -0.25, 0.1)));

  //print out feld info
  INFORM ("Feld () -> Loc () = " + ToStr (Feld () -> Loc ()));
  INFORM ("Feld () -> Width () = " + ToStr (Feld () -> Width ()));
  INFORM ("Feld () -> Height () = " + ToStr (Feld () -> Height ()));
  INFORM ("FeldAspect (Feld ()) = " + ToStr (FeldAspect (Feld ())));
  INFORM ("Diag (Feld ()) = " + ToStr (Diag (Feld ())));
}