greenhouse
a creative coding toolkit for spatial interfaces

Vect

3 floating-point numbers, all in a bunch. Good for representing a point in space or a directional vector.

The Full Reference and Header provide the best documentation for this class.

  • Vect ()
  • Dot ()
  • Cross ()
  • DistFrom ()
  • Norm ()
  • ZeroVect

Example

#define WORKER
#include "Greenhouse.h"

void Setup ()
{ Vect v (3, 2, 1);
  Vect over = Vect (Feld () -> Over ());
  Vect up = Vect (Feld () -> Up ());

  // Get the angle between the over and up vectors
  float64 angle = over . Dot (up);
  // Get the norm vector of the window and scale by 10
  Vect norm = 10 * over . Cross (up);

  // get the location of the center of the window
  v = Feld () -> Loc ();

  // get the location of the upper right corner of the window
  Vect corner = v +
                0.5 * Feld () -> Width ()  * over +
                0.5 * Feld () -> Height () * up;

  // get the distance between the two points
  float64 dist = v . DistFrom (corner);
}