Axle 0.1.0
A simple, lightweight C++ game framework built on top of Raylib.
 
Loading...
Searching...
No Matches
Axle::Math::Vector2 Class Reference

A 2D Vector class. More...

#include <vector2.h>

Public Member Functions

 Vector2 ()
 Construct a new Vector2 object with x and y set to 0.
 
 Vector2 (double x, double y)
 Construct a new Vector2 object with the given x and y values.
 
Vector2 operator+ (const Vector2 &other) const
 Operator overload for addition.
 
Vector2 operator- (const Vector2 &other) const
 Operator overload for subtraction.
 
Vector2 operator* (double scalar) const
 Operator overload for scalar multiplication.
 
Vector2 operator/ (double scalar) const
 Operator overload for scalar division.
 
Vector2operator+= (const Vector2 &other)
 Operator overload for addition assignment.
 
Vector2operator-= (const Vector2 &other)
 Operator overload for subtraction assignment.
 
Vector2operator*= (double scalar)
 Operator overload for scalar multiplication assignment.
 
Vector2operator/= (double scalar)
 Operator overload for scalar division assignment.
 
bool operator== (const Vector2 &other) const
 Operator overload for equality.
 
bool operator!= (const Vector2 &other) const
 Operator overload for inequality.
 
Vector2 operator- () const
 Operator overload for negation.
 

Public Attributes

double x
 The x component of the vector.
 
double y
 The y component of the vector.
 

Detailed Description

A 2D Vector class.

Constructor & Destructor Documentation

◆ Vector2()

Axle::Math::Vector2::Vector2 ( double x,
double y )

Construct a new Vector2 object with the given x and y values.

Parameters
xThe x component of the vector
yThe y component of the vector

Member Function Documentation

◆ operator!=()

bool Axle::Math::Vector2::operator!= ( const Vector2 & other) const

Operator overload for inequality.

Parameters
otherThe other vector to compare
Returns
true If the vectors are not equal
false If the vectors are equal

◆ operator*()

Vector2 Axle::Math::Vector2::operator* ( double scalar) const

Operator overload for scalar multiplication.

Parameters
scalarThe scalar to multiply by
Returns
Vector2 The result of the multiplication

◆ operator*=()

Vector2 & Axle::Math::Vector2::operator*= ( double scalar)

Operator overload for scalar multiplication assignment.

Parameters
scalarThe scalar to multiply by
Returns
Vector2& The result of the multiplication

◆ operator+()

Vector2 Axle::Math::Vector2::operator+ ( const Vector2 & other) const

Operator overload for addition.

Parameters
otherThe other vector to add
Returns
Vector2 The result of the addition

◆ operator+=()

Vector2 & Axle::Math::Vector2::operator+= ( const Vector2 & other)

Operator overload for addition assignment.

Parameters
otherThe other vector to add
Returns
Vector2& The result of the addition

◆ operator-() [1/2]

Vector2 Axle::Math::Vector2::operator- ( ) const

Operator overload for negation.

Returns
Vector2 The negated vector

◆ operator-() [2/2]

Vector2 Axle::Math::Vector2::operator- ( const Vector2 & other) const

Operator overload for subtraction.

Parameters
otherThe other vector to subtract
Returns
Vector2 The result of the subtraction

◆ operator-=()

Vector2 & Axle::Math::Vector2::operator-= ( const Vector2 & other)

Operator overload for subtraction assignment.

Parameters
otherThe other vector to subtract
Returns
Vector2& The result of the subtraction

◆ operator/()

Vector2 Axle::Math::Vector2::operator/ ( double scalar) const

Operator overload for scalar division.

Parameters
scalarThe scalar to divide by
Returns
Vector2 The result of the division

◆ operator/=()

Vector2 & Axle::Math::Vector2::operator/= ( double scalar)

Operator overload for scalar division assignment.

Parameters
scalarThe scalar to divide by
Returns
Vector2& The result of the division

◆ operator==()

bool Axle::Math::Vector2::operator== ( const Vector2 & other) const

Operator overload for equality.

Parameters
otherThe other vector to compare
Returns
true If the vectors are equal
false If the vectors are not equal

The documentation for this class was generated from the following files: