From 8e9d04aaec9f3fd9f623c13d49a4515210165a38 Mon Sep 17 00:00:00 2001 From: Milan Nikolic Date: Sun, 12 Nov 2023 10:58:33 +0100 Subject: [PATCH] Add math functions --- raylib/raymath.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/raylib/raymath.go b/raylib/raymath.go index ebd4000..34522c9 100644 --- a/raylib/raymath.go +++ b/raylib/raymath.go @@ -454,6 +454,19 @@ func Vector3Reject(v1, v2 Vector3) Vector3 { return result } +// Vector3OrthoNormalize - Orthonormalize provided vectors +// Makes vectors normalized and orthogonal to each other +// Gram-Schmidt function implementation +func Vector3OrthoNormalize(v1, v2 *Vector3) { + Vector3Normalize(*v1) + + vn1 := Vector3CrossProduct(*v1, *v2) + Vector3Normalize(vn1) + + vn2 := Vector3CrossProduct(vn1, *v1) + *v2 = vn2 +} + // Vector3Transform - Transforms a Vector3 by a given Matrix func Vector3Transform(v Vector3, mat Matrix) Vector3 { result := Vector3{}