aboutsummaryrefslogtreecommitdiff
path: root/vendor/libftm/src/vec3/ftm_vec3cross.c
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/libftm/src/vec3/ftm_vec3cross.c')
-rw-r--r--vendor/libftm/src/vec3/ftm_vec3cross.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/libftm/src/vec3/ftm_vec3cross.c b/vendor/libftm/src/vec3/ftm_vec3cross.c
new file mode 100644
index 0000000..c27534e
--- /dev/null
+++ b/vendor/libftm/src/vec3/ftm_vec3cross.c
@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ftm_vec3cross.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/05/09 21:20:41 by charles #+# #+# */
+/* Updated: 2020/05/09 21:25:44 by charles ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libftm_vec3.h"
+
+/*
+** s1 = a2 * b3 - a3 * b2
+** s2 = a3 * b1 - a1 * b3
+** s3 = a1 * b2 - a2 * b1
+*/
+
+void ftm_vec3cross(t_ftmvec3 *dst, t_ftmvec3 *a, t_ftmvec3 *b)
+{
+ dst->v[0] = a->v[1] * b->v[2] - a->v[2] * b->v[1];
+ dst->v[1] = a->v[2] * b->v[0] - a->v[0] * b->v[2];
+ dst->v[2] = a->v[0] * b->v[1] - a->v[1] * b->v[0];
+}