From 5c613a10364f30bd6add25f7950433f0c482c3ca Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Sun, 31 Oct 2021 13:54:11 -0400 Subject: (mkosarek) Working undamped spring motion --- shared_cpp/mathlib.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'shared_cpp/mathlib.cpp') 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(rand()) / static_cast(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); } -- cgit v1.2.1