2020-09-21 17:17:34 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-26 15:17:35 +00:00
|
|
|
//
|
2020-09-21 17:17:34 +00:00
|
|
|
// EmulationStation Desktop Edition
|
2020-06-26 15:17:35 +00:00
|
|
|
// Vector4f.cpp
|
|
|
|
//
|
|
|
|
// 4-dimensional floating point vector functions.
|
|
|
|
//
|
|
|
|
|
2017-11-13 22:16:38 +00:00
|
|
|
#include "math/Vector4f.h"
|
|
|
|
|
2021-01-19 20:50:14 +00:00
|
|
|
#include <cmath>
|
|
|
|
|
2017-11-13 22:16:38 +00:00
|
|
|
Vector4f& Vector4f::round()
|
|
|
|
{
|
2021-01-19 20:50:14 +00:00
|
|
|
mX = std::round(mX);
|
|
|
|
mY = std::round(mY);
|
|
|
|
mZ = std::round(mZ);
|
|
|
|
mW = std::round(mW);
|
2017-11-13 22:16:38 +00:00
|
|
|
|
2020-06-26 15:17:35 +00:00
|
|
|
return *this;
|
|
|
|
}
|
2017-11-13 22:16:38 +00:00
|
|
|
|
|
|
|
Vector4f& Vector4f::lerp(const Vector4f& _start, const Vector4f& _end, const float _fraction)
|
|
|
|
{
|
2020-06-26 15:17:35 +00:00
|
|
|
mX = Math::lerp(_start.x(), _end.x(), _fraction);
|
|
|
|
mY = Math::lerp(_start.y(), _end.y(), _fraction);
|
|
|
|
mZ = Math::lerp(_start.z(), _end.z(), _fraction);
|
|
|
|
mW = Math::lerp(_start.w(), _end.w(), _fraction);
|
2017-11-13 22:16:38 +00:00
|
|
|
|
2020-06-26 15:17:35 +00:00
|
|
|
return *this;
|
|
|
|
}
|