Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

# Unigine::vec3 Struct

Vector of 3 float components.

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

## UNIGINE_INLINE vec3 ()

Default constructor that produces a zero vector.

## UNIGINE_INLINE vec3 (const vec3 & v)

Initialization by a vector.

### Arguments

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

## UNIGINE_INLINE vec3 (const vec2 & v, float z)

Initialization by a vector and a scalar.

### Arguments

• const vec2 & v - The value of the vector.
• float z - Z component of the vector.

## UNIGINE_INLINE vec3 (float x, float y, float z)

Initialization by scalars.

### Arguments

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

## explicit UNIGINE_INLINE vec3 (float v)

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

### Arguments

• float v - The value of the vector.

## explicit UNIGINE_INLINE vec3 (const vec2 & v)

Initialization by a two component vector: x=v.x, y=v.y, z=0.0f.

### Arguments

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

## explicit UNIGINE_INLINE vec3 (const vec4 & v)

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

### Arguments

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

## explicit UNIGINE_INLINE vec3 (const dvec3 & v)

Initialization by a vector of double components.

### Arguments

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

## explicit UNIGINE_INLINE vec3 (const ivec3 & v)

Initialization by a vector of integer components.

### Arguments

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

## explicit UNIGINE_INLINE vec3 (const float * v)

Initialization by a pointer to the vector.

### Arguments

• const float * v - Pointer to the vector.

## UNIGINE_INLINE vec3 operator- () const

Vector negation.

### Return value

The resulting vector.

## UNIGINE_INLINE vec3 & operator*= (float v)

Scalar multiplication.

### Arguments

• float v - The value of the scalar.

### Return value

The resulting vector.

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

Vector multiplication.

### Arguments

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

### Return value

The resulting vector.

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

### Arguments

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

### Return value

The resulting vector.

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

Vector subtraction.

### Arguments

• const vec3 & 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.

The array item.

## UNIGINE_INLINE float operator[] (int i) const

Constant array access.

### Arguments

• int i - Array item index.

The array item.

## UNIGINE_INLINE void set (float x_, float y_, float z_)

Set vector.

### Arguments

• float x_ - X component of the vector.
• float y_ - Y component of the vector.
• float z_ - Z 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::vec3:: Union

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