class Integer2D
Defined in:
The TSInteger.h
Integer2D
class encapsulates a vector containing a pair of integer coordinates.
Definition
class Integer2D : public Vec2D<TypeInteger2D>
Member Functions
Integer2D::Set |
Sets both components of a vector. |
Constructor
Integer2D();
Integer2D(int32 i, int32 j);
template <typename type> Integer2D(const Vec2D<type>& u);
Parameters
i |
The value of the x coordinate. |
j |
The value of the y coordinate. |
u |
Another 2D vector, possibly with a different component type, that is converted to an Integer2D .
|
Description
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
int32& operator [](machine k); |
Returns a reference to the k -th scalar component of a vector. The value of k must be 0 or 1.
|
const int32& operator [](machine k) const; |
Returns a constant reference to the k -th scalar component of a vector. The value of k must be 0 or 1.
|
Integer2D& operator +=(const Integer2D& v); |
Adds the vector v .
|
Integer2D& operator -=(const Integer2D& v); |
Subtracts the vector v .
|
Nonmember Operations
bool operator ==(const Integer2D& v1, const Integer2D& v2) const; |
Returns a boolean value indicating whether the two vectors v1 and v2 are equal.
|
bool operator !=(const Integer2D& v1, const Integer2D& v2) const; |
Returns a boolean value indicating whether the two vectors v1 and v2 are not equal.
|
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