Voltray Engine Docs
Loading...
Searching...
No Matches
Vec2 Struct Reference

Represents a 2-dimensional vector with float components. More...

#include <Vec2.h>

Public Member Functions

 Vec2 ()
 Default constructor. Initializes all components to zero.
 
 Vec2 (float x, float y)
 
Vec2 operator+ (const Vec2 &other) const
 
Vec2 operator- (const Vec2 &other) const
 
Vec2 operator* (float scalar) const
 

Public Attributes

float x
 
float y
 The x and y components of the vector.
 

Detailed Description

Represents a 2-dimensional vector with float components.

Constructor & Destructor Documentation

◆ Vec2() [1/2]

Vec2::Vec2 ( )
inline

Default constructor. Initializes all components to zero.

◆ Vec2() [2/2]

Vec2::Vec2 ( float  x,
float  y 
)
inline

Constructs a vector with the given x and y components.

Parameters
xThe x component.
yThe y component.

Member Function Documentation

◆ operator*()

Vec2 Vec2::operator* ( float  scalar) const
inline

Multiplies this vector by a scalar.

Parameters
scalarThe scalar value.
Returns
The result of scalar multiplication.

◆ operator+()

Vec2 Vec2::operator+ ( const Vec2 other) const
inline

Adds this vector to another vector.

Parameters
otherThe vector to add.
Returns
The result of vector addition.

◆ operator-()

Vec2 Vec2::operator- ( const Vec2 other) const
inline

Subtracts another vector from this vector.

Parameters
otherThe vector to subtract.
Returns
The result of vector subtraction.

Member Data Documentation

◆ x

float Vec2::x

◆ y

float Vec2::y

The x and y components of the vector.


The documentation for this struct was generated from the following file: