Facebook Twitter YouTube

class Vec2D

Defined in:  TSMath.h
The Vec2D class template serves as a generic base class for other 2D vector types.
Definition

template <typename type> class Vec2D

Template Parameters
type The type of each component of the vector.
Constructor

Vec2D();

Vec2D(type a, type b);

Parameters
a The value of the x coordinate.
b The value of the y coordinate.
Description
The Vec2D class template is used to store the x and y components of a two-dimensional vector. The type of the components is given by the type template parameter.

Objects of the Vec2D type cannot be constructed directly. Vector objects are utilized by constructing objects having the subclass types Vector2D and Integer2D.

The default constructor leaves the components of the vector undefined. If the values a and b are supplied, then they are assigned to the x and y coordinates of the vector, respectively.
Overloaded Operators
type& operator [](machine k); Returns a reference to the k-th component of a vector. The value of k must be 0 or 1.
const type& operator [](machine k) const; Returns a constant reference to the k-th component of a vector. The value of k must be 0 or 1.
Nonmember Operations
bool operator ==(const Vec2D<type>& v1, const Vec2D<type>& v2) const; Returns a boolean value indicating the equality of the two vectors v1 and v2.
bool operator !=(const Vec2D<type>& v1, const Vec2D<type>& v2) const; Returns a boolean value indicating the inequality of the two vectors v1 and v2.
See Also

Vector2D

Integer2D

Vec3D

Vec4D