From cccadc5d2141ebcfb2cf94d0db86dd0705520d4e Mon Sep 17 00:00:00 2001 From: Quinn Date: Mon, 3 Feb 2025 12:46:26 -0500 Subject: [PATCH] consted some vector functions --- src/Vector3D.cpp | 8 ++++---- src/Vector3D.hpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Vector3D.cpp b/src/Vector3D.cpp index 350851a..d34daa4 100644 --- a/src/Vector3D.cpp +++ b/src/Vector3D.cpp @@ -47,7 +47,7 @@ V3D::V3D(const V3D &other) } template -std::array V3D::ToArray() +std::array V3D::ToArray() const { return {this->x, this->y, this->z}; } @@ -61,19 +61,19 @@ void V3D::operator=(const V3D &other) } template -V3D V3D::operator+(const V3D &other) +V3D V3D::operator+(const V3D &other) const { return V3D{this->x + other.x, this->y + other.y, this->z + other.z}; } template -V3D V3D::operator-(const V3D &other) +V3D V3D::operator-(const V3D &other) const { return V3D{this->x - other.x, this->y - other.y, this->z - other.z}; } template -V3D V3D::operator*(Type scalar) +V3D V3D::operator*(Type scalar) const { return V3D{this->x * scalar, this->y * scalar, this->z * scalar}; } diff --git a/src/Vector3D.hpp b/src/Vector3D.hpp index 818a565..f0c36ce 100644 --- a/src/Vector3D.hpp +++ b/src/Vector3D.hpp @@ -18,13 +18,13 @@ public: template V3D(const V3D &other); - std::array ToArray(); + std::array ToArray() const; - V3D operator+(const V3D &other); + V3D operator+(const V3D &other) const; - V3D operator-(const V3D &other); + V3D operator-(const V3D &other) const; - V3D operator*(Type scalar); + V3D operator*(Type scalar) const; void operator=(const V3D &other);