hs

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | LICENSE

commit 9ecab260f9a8122ce76aafffb02319d1f207e3be
parent 5173bff7ee7379b30d8ae33ca26246c566f85672
Author: Samdal <samdal@protonmail.com>
Date:   Tue,  5 Oct 2021 23:31:34 +0200

added to math

Diffstat:
Mhs_math.h | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/hs_math.h b/hs_math.h @@ -105,6 +105,13 @@ vec2_add(const vec2 v1, const vec2 v2) return (vec2){v1.x + v2.x, v1.y + v2.y}; } +inline static void +vec2_add_in_place(vec2* v1, const vec2 v2) +{ + v1->x += v2.x; + v1->y += v2.y; +} + inline static vec2 vec2_sub(const vec2 v1, const vec2 v2) { @@ -148,6 +155,12 @@ vec2_norm(const vec2 vector) return len == 0.0f ? vector : vec2_scale(vector, 1.0f / len); } +inline static uint32_t +vec2_null(const vec2 vector) +{ + return (vector.x == 0 && vector.y == 0); +} + inline static vec2i vec2i_div(const vec2i vector, const int32_t divisor) {