This version of documentation is OUTDATED! Please switch to the latest one.

# Unigine::ivec2 Struct

Vector of 2 integer components.

To use this structure, include the UnigineMathLib.h file.

## UNIGINE_DECLARE_USE_MEMORY UNIGINE_INLINEivec2 ()

Default constructor that produces a zero vector.

## UNIGINE_INLINEivec2 (const ivec2 & v)

Initialization by a vector.

### Arguments

• const ivec2 & v - The value of the vector.

## UNIGINE_INLINEivec2 (int x, int y)

Initialization by scalars.

### Arguments

• int x - X component of the vector.
• int y - Y component of the vector.

## explicit UNIGINE_INLINEivec2 (int v)

Initialization by a scalar: x=v, y=v.

### Arguments

• int v - The value of the vector.

## explicit UNIGINE_INLINEivec2 (const ivec3 & v)

Initialization by a four component vector: x=v.x, y=v.y.

### Arguments

• const ivec3 & v - The value of the vector.

## explicit UNIGINE_INLINEivec2 (const ivec4 & v)

Initialization by a four component vector: x=v.x, y=v.y.

### Arguments

• const ivec4 & v - The value of the vector.

## explicit UNIGINE_INLINEivec2 (const vec2 & v)

Initialization by a vector.

### Arguments

• const vec2 & v - The value of the vector.

## explicit UNIGINE_INLINEivec2 (const dvec2 & v)

Initialization by a vector of double components.

### Arguments

• const dvec2 & v - The value of the vector.

## explicit UNIGINE_INLINEivec2 (const int * v)

Initialization by a pointer to the vector.

### Arguments

• const int * v - Pointer to the vector.

## UNIGINE_INLINE ivec2operator- () const

Vector negation.

### Return value

The resulting vector.

## UNIGINE_INLINE ivec2 &operator*= (int v)

Scalar multiplication.

### Arguments

• int v - The value of the scalar.

### Return value

The resulting vector.

## UNIGINE_INLINE ivec2 &operator*= (const ivec2 & v)

Vector multiplication.

### Arguments

• const ivec2 & v - The value of the vector.

### Return value

The resulting vector.

## UNIGINE_INLINE ivec2 &operator/= (int v)

Scalar division.

### Arguments

• int v - The value of the scalar.

### Return value

The resulting vector.

## UNIGINE_INLINE ivec2 &operator/= (const ivec2 & v)

Vector division.

### Arguments

• const ivec2 & v - The value of the vector.

### Return value

The resulting vector.

## UNIGINE_INLINE ivec2 &operator+= (const ivec2 & v)

### Arguments

• const ivec2 & v - The value of the vector.

### Return value

The resulting vector.

## UNIGINE_INLINE ivec2 &operator-= (const ivec2 & v)

Vector subtraction.

### Arguments

• const ivec2 & v - The value of the vector.

### Return value

The resulting vector.

## UNIGINE_INLINE ivec2 &operator<<= (int v)

Left bit shift.

### Arguments

• int v - The shift amount.

### Return value

The resulting vector.

## UNIGINE_INLINE ivec2 &operator>>= (int v)

Right bit shift.

### Arguments

• int v - The shift amount.

### Return value

The resulting vector.

## UNIGINE_INLINE int &operator[] (int i)

Array access.

### Arguments

• int i - Array item index.

The array item.

## UNIGINE_INLINE intoperator[] (int i) const

Constant array access.

### Arguments

• int i - Array item index.

The array item.

## UNIGINE_INLINE voidset (int x_, int y_)

Set vector.

### Arguments

• int x_ - X component of the vector.
• int y_ - Y component of the vector.

## UNIGINE_INLINE voidset (const int * v)

Set vector.

### Arguments

• const int * v - Pointer to the vector.

## UNIGINE_INLINE int *get ()

Get a pointer to the vector.

### Return value

Pointer to the vector.

## UNIGINE_INLINE const int *get () const

Get a constant pointer to the vector.

### Return value

Pointer to the vector.

## Unigine::ivec2:: Union

union {
struct {
int x;
int y;
};
int v[2];
};
Last update: 2017-07-03