diff options
author | Matthew Kosarek <mattkae@protonmail.com> | 2021-10-31 13:54:11 -0400 |
---|---|---|
committer | Matthew Kosarek <mattkae@protonmail.com> | 2021-10-31 13:54:11 -0400 |
commit | 5c613a10364f30bd6add25f7950433f0c482c3ca (patch) | |
tree | af8f6e481b6400329eca12bd8cdb35e0237d63af /shared_cpp/mathlib.cpp | |
parent | a214b4f8977a4b115710b5c9d152b392ac8e24f7 (diff) |
(mkosarek) Working undamped spring motion
Diffstat (limited to 'shared_cpp/mathlib.cpp')
-rw-r--r-- | shared_cpp/mathlib.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/shared_cpp/mathlib.cpp b/shared_cpp/mathlib.cpp index 3402f0e..5996ba3 100644 --- a/shared_cpp/mathlib.cpp +++ b/shared_cpp/mathlib.cpp @@ -12,6 +12,13 @@ // *************************************** // Vector2 +Vector2::Vector2() { } + +Vector2::Vector2(float inX, float inY) { + x = inX; + y = inY; +} + Vector2 getRandomNormalVector2() { Vector2 retval = { static_cast<float>(rand()) / static_cast<float>(RAND_MAX), @@ -291,6 +298,10 @@ Vector4 Vector4::cross(const Vector4& other) { }; } +Vector4 lerp(Vector4 start, Vector4 end, float t) { + return (end - start) * t + start; +} + Vector4 Vector4::operator+(const Vector4& v2) { return add(v2); } |