Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes

vec2 Struct (C++)

Vector of 2 float components.

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

Unigine::vec2Structure

Members


UNIGINE_DECLARE_USE_MEMORY UNIGINE_INLINE vec2 ()

Default constructor that produces a zero vector.

UNIGINE_INLINE vec2 (const vec2 & v)

Initialization by a vector.

Arguments

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

UNIGINE_INLINE vec2 (float x, float y)

Initialization by scalars.

Arguments

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

explicit UNIGINE_INLINE vec2 (float v)

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

Arguments

  • float v - The value of the vector.

explicit UNIGINE_INLINE vec2 (const vec3 & v)

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

Arguments

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

explicit UNIGINE_INLINE vec2 (const vec4 & v)

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

Arguments

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

explicit UNIGINE_INLINE vec2 (const dvec2 & v)

Initialization by a vector of double components.

Arguments

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

explicit UNIGINE_INLINE vec2 (const ivec2 & v)

Initialization by a vector of integer components.

Arguments

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

explicit UNIGINE_INLINE vec2 (const float * v)

Initialization by a pointer to the vector.

Arguments

  • const float * v - Pointer to the vector.

UNIGINE_INLINE vec2 operator- () const

Vector negation.

Return value

The resulting vector.

UNIGINE_INLINE vec2 & operator*= (float v)

Scalar multiplication.

Arguments

  • float v - The value of the scalar.

Return value

The resulting vector.

UNIGINE_INLINE vec2 & operator*= (const vec2 & v)

Vector multiplication.

Arguments

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

Return value

The resulting vector.

UNIGINE_INLINE vec2 & operator+= (const vec2 & v)

Vector addition.

Arguments

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

Return value

The resulting vector.

UNIGINE_INLINE vec2 & operator-= (const vec2 & v)

Vector subtraction.

Arguments

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

Return value

The resulting vector.

UNIGINE_INLINE float & operator[] (int i)

Array access.

Arguments

  • int i - Array item index.

Return value

The array item.

UNIGINE_INLINE float operator[] (int i) const

Constant array access.

Arguments

  • int i - Array item index.

Return value

The array item.

UNIGINE_INLINE void set (float x_, float y_)

Set vector.

Arguments

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

UNIGINE_INLINE void set (const float * v)

Set vector.

Arguments

  • const float * v - Pointer to the vector.

UNIGINE_INLINE void get (float * v) const

Get vector.

Arguments

  • float * v - Pointer to the vector.

UNIGINE_INLINE float * get ()

Get a pointer to the vector.

Return value

Pointer to the vector.

UNIGINE_INLINE const float * get () const

Get a constant pointer to the vector.

Return value

Pointer to the vector.

Unigine::vec2::Union

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