Facebook Twitter YouTube

class Integer2D

Defined in:  TSInteger.h
The Integer2D class encapsulates a vector containing a pair of integer coordinates.

class Integer2D : public Vec2D<int32>

Member Functions
Integer2D::Set Sets both components of a vector.


Integer2D(int32 i, int32 j);

template <typename type> Integer2D(const Vec2D<type>& w);

i The value of the x coordinate.
j The value of the y coordinate.
w Another 2D vector, possibly with a different component type, that is converted to an Integer2D.
The Integer2D class is used to store a vector having two integer components x and y.

The default constructor leaves the components of the vector undefined. If the values i and j are supplied, then they are assigned to the x and y coordinates of the vector, respectively.
Overloaded Operators
Integer2D& operator +=(const Integer2D& v); Adds the vector v.
Integer2D& operator -=(const Integer2D& v); Subtracts the vector v.
Nonmember Operations
Integer2D operator +(const Integer2D& v1, const Integer2D& v2) const; Returns the componentwise sum of the vectors v1 and v2.
Integer2D operator -(const Integer2D& v1, const Integer2D& v2) const; Returns the componentwise difference of the vectors v1 and v2.
Integer2D operator *(const Integer2D& v, int32 t) const; Returns a vector for which each component of the vector v has been multiplied by t.
Integer2D operator /(const Integer2D& v, int32 t) const; Returns a vector for which each component of the vector v has been divided by t.
Base Classes
Vec2D Vectors use a generic base class to store their components.
See Also