Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
Vector3 Class Reference

Represents a 3D vector with x, y, and z components. This class provides basic vector operations such as addition, subtraction, multiplication, division, normalization, and length calculation. More...

#include <vector3.h>

Public Member Functions

 Vector3 ()
 
 Vector3 (float x, float y, float z)
 
Vector3 operator+ (const Vector3 &other) const noexcept
 
Vector3 operator- (const Vector3 &other) const noexcept
 
Vector3 operator* (const Vector3 &other) const noexcept
 
Vector3 operator/ (const Vector3 &other) const noexcept
 
Vector3operator+= (const Vector3 &other) noexcept
 
Vector3operator-= (const Vector3 &other) noexcept
 
Vector3operator*= (const Vector3 &other) noexcept
 
Vector3operator/= (const Vector3 &other) noexcept
 
Vector3 operator* (float value) const noexcept
 
Vector3 operator/ (float value) const noexcept
 
Vector3operator*= (float value) noexcept
 
Vector3operator/= (float value) noexcept
 
float length () const noexcept
 Calculates the length (magnitude) of the vector.
 
void normalize () noexcept
 Normalizes the vector to have a length of 1.
 
bool equals (const Vector3 &other) const noexcept
 Checks if this vector is equal to another vector.
 

Public Attributes

float x
 
float y
 
float z
 

Detailed Description

Represents a 3D vector with x, y, and z components. This class provides basic vector operations such as addition, subtraction, multiplication, division, normalization, and length calculation.

Constructor & Destructor Documentation

◆ Vector3() [1/2]

Vector3::Vector3 ( )

◆ Vector3() [2/2]

Vector3::Vector3 ( float  x,
float  y,
float  z 
)

Member Function Documentation

◆ equals()

bool Vector3::equals ( const Vector3 other) const
noexcept

Checks if this vector is equal to another vector.

Parameters
otherThe other vector to compare with.
Returns
true if the vectors are equal, false otherwise.

◆ length()

float Vector3::length ( ) const
noexcept

Calculates the length (magnitude) of the vector.

Returns
The length of the vector as a float.

◆ normalize()

void Vector3::normalize ( )
noexcept

Normalizes the vector to have a length of 1.

Returns
void

◆ operator*() [1/2]

Vector3 Vector3::operator* ( const Vector3 other) const
noexcept

◆ operator*() [2/2]

Vector3 Vector3::operator* ( float  value) const
noexcept

◆ operator*=() [1/2]

Vector3 & Vector3::operator*= ( const Vector3 other)
noexcept

◆ operator*=() [2/2]

Vector3 & Vector3::operator*= ( float  value)
noexcept

◆ operator+()

Vector3 Vector3::operator+ ( const Vector3 other) const
noexcept

◆ operator+=()

Vector3 & Vector3::operator+= ( const Vector3 other)
noexcept

◆ operator-()

Vector3 Vector3::operator- ( const Vector3 other) const
noexcept

◆ operator-=()

Vector3 & Vector3::operator-= ( const Vector3 other)
noexcept

◆ operator/() [1/2]

Vector3 Vector3::operator/ ( const Vector3 other) const
noexcept

◆ operator/() [2/2]

Vector3 Vector3::operator/ ( float  value) const
noexcept

◆ operator/=() [1/2]

Vector3 & Vector3::operator/= ( const Vector3 other)
noexcept

◆ operator/=() [2/2]

Vector3 & Vector3::operator/= ( float  value)
noexcept

Member Data Documentation

◆ x

float Vector3::x

◆ y

float Vector3::y

◆ z

float Vector3::z

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