From 79734ee03cccf0ba9b2e7764f6f8e6832b97527d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20GUEZO?= Date: Sun, 16 Mar 2025 17:33:23 +0100 Subject: [PATCH] fix(vector3): optimize vec3Proj. --- src/math/vector3.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/math/vector3.c b/src/math/vector3.c index 3776e6e..4b4ebb5 100644 --- a/src/math/vector3.c +++ b/src/math/vector3.c @@ -112,11 +112,9 @@ Vec3* vec3Refl(Vec3* v, Vec3* normal) if (!v || !normal) return NULL; Vec3* proj = vec3Proj(v, normal); - if (!proj) return NULL; - Vec3* scal = vec3Scale(proj, 2.f); - Vec3* rlt = vec3Sub(v, scal); + vec3Free(proj); vec3Free(scal); return rlt; @@ -126,7 +124,6 @@ float vec3Dist(Vec3* a, Vec3* b) { if (!a || !b) return NAN; Vec3* vsub = vec3Sub(a, b); - if (!vsub) return NAN; float rlt = vec3Len(vsub); vec3Free(vsub);