Vector Math

class Vec2

This class implements a 2-dimensional real-valued vector. Individual elements are represent with double precision floating point numbers. To use the Vec2 class you must include the header

    #include <gfx/vec2.h>

Constructor Methods

The Vec2 class defines the following set of constructors:

    Vec2();                    // Initializes vector to (0 0).
    Vec2(double x, double y);  // Initializes vector to (x y).
    Vec2(double s);            // Initializes vector to (s s)

    Vec2(const Vec2& v);       // 
    Vec2(const float  v[2]);   // These copy values from v
    Vec2(const double v[2]);   // 

Specialized Functions

Beyond the standard functions supported by all vector classes, the Vec2 class provides the following additional function:

    Vec2 perp(const Vec2 &v);
that returns a new vector which is perpendicular to the given vector.