consted some vector functions

This commit is contained in:
2025-02-03 12:46:26 -05:00
parent 519c953fcb
commit cccadc5d21
2 changed files with 8 additions and 8 deletions

View File

@@ -47,7 +47,7 @@ V3D<Type>::V3D(const V3D<OtherType> &other)
} }
template <typename Type> template <typename Type>
std::array<Type, 3> V3D<Type>::ToArray() std::array<Type, 3> V3D<Type>::ToArray() const
{ {
return {this->x, this->y, this->z}; return {this->x, this->y, this->z};
} }
@@ -61,19 +61,19 @@ void V3D<Type>::operator=(const V3D<Type> &other)
} }
template <typename Type> template <typename Type>
V3D<Type> V3D<Type>::operator+(const V3D<Type> &other) V3D<Type> V3D<Type>::operator+(const V3D<Type> &other) const
{ {
return V3D<Type>{this->x + other.x, this->y + other.y, this->z + other.z}; return V3D<Type>{this->x + other.x, this->y + other.y, this->z + other.z};
} }
template <typename Type> template <typename Type>
V3D<Type> V3D<Type>::operator-(const V3D<Type> &other) V3D<Type> V3D<Type>::operator-(const V3D<Type> &other) const
{ {
return V3D<Type>{this->x - other.x, this->y - other.y, this->z - other.z}; return V3D<Type>{this->x - other.x, this->y - other.y, this->z - other.z};
} }
template <typename Type> template <typename Type>
V3D<Type> V3D<Type>::operator*(Type scalar) V3D<Type> V3D<Type>::operator*(Type scalar) const
{ {
return V3D<Type>{this->x * scalar, this->y * scalar, this->z * scalar}; return V3D<Type>{this->x * scalar, this->y * scalar, this->z * scalar};
} }

View File

@@ -18,13 +18,13 @@ public:
template <typename OtherType> template <typename OtherType>
V3D(const V3D<OtherType> &other); V3D(const V3D<OtherType> &other);
std::array<Type, 3> ToArray(); std::array<Type, 3> ToArray() const;
V3D<Type> operator+(const V3D<Type> &other); V3D<Type> operator+(const V3D<Type> &other) const;
V3D<Type> operator-(const V3D<Type> &other); V3D<Type> operator-(const V3D<Type> &other) const;
V3D<Type> operator*(Type scalar); V3D<Type> operator*(Type scalar) const;
void operator=(const V3D<Type> &other); void operator=(const V3D<Type> &other);