2020-11-22 23:25:22 -06:00
|
|
|
#include "tempest/vector/C3Vector.hpp"
|
2020-11-26 10:48:52 -06:00
|
|
|
#include "tempest/Math.hpp"
|
2020-11-22 23:25:22 -06:00
|
|
|
|
|
|
|
|
C3Vector& C3Vector::operator*=(float a) {
|
|
|
|
|
this->x *= a;
|
|
|
|
|
this->y *= a;
|
|
|
|
|
this->z *= a;
|
|
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-26 10:48:52 -06:00
|
|
|
float C3Vector::Mag() const {
|
|
|
|
|
return CMath::sqrt(this->SquaredMag());
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-26 10:59:42 -06:00
|
|
|
void C3Vector::Normalize() {
|
|
|
|
|
this->operator*=(1.0f / this->Mag());
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-22 23:25:22 -06:00
|
|
|
float C3Vector::SquaredMag() const {
|
|
|
|
|
return this->x * this->x + this->y * this->y + this->z * this->z;
|
|
|
|
|
}
|