aboutsummaryrefslogtreecommitdiff
path: root/vendor/libftm/inc
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-05-11 13:29:51 +0200
committerCharles <sircharlesaze@gmail.com>2020-05-11 13:29:51 +0200
commitd07d87964f13d3c1e6ad8c2f6d7db21101f1ef34 (patch)
tree52dd2e82580eb3c70201991b53a2a2b4c434908b /vendor/libftm/inc
parent0700a8f567ab733a57fe688e45e5092d3fa1c1a0 (diff)
downloadscop-d07d87964f13d3c1e6ad8c2f6d7db21101f1ef34.tar.gz
scop-d07d87964f13d3c1e6ad8c2f6d7db21101f1ef34.tar.bz2
scop-d07d87964f13d3c1e6ad8c2f6d7db21101f1ef34.zip
libftm matrix, dynamic vector instead of fixed size
Diffstat (limited to 'vendor/libftm/inc')
-rw-r--r--vendor/libftm/inc/libftm_mat.h39
-rw-r--r--vendor/libftm/inc/libftm_vec.h (renamed from vendor/libftm/inc/libftm_vec3.h)34
-rw-r--r--vendor/libftm/inc/libftm_vec4.h30
3 files changed, 59 insertions, 44 deletions
diff --git a/vendor/libftm/inc/libftm_mat.h b/vendor/libftm/inc/libftm_mat.h
new file mode 100644
index 0000000..63679bb
--- /dev/null
+++ b/vendor/libftm/inc/libftm_mat.h
@@ -0,0 +1,39 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* libftm_mat.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/05/11 12:50:40 by charles #+# #+# */
+/* Updated: 2020/05/11 13:28:55 by charles ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef LIBFTM_MAT_H
+# define LIBFTM_MAT_H
+
+# include <stddef.h>
+# include <stdlib.h>
+# include "libftm_vec.h"
+
+typedef struct s_ftmmat
+{
+ float *m;
+ struct
+ {
+ size_t x;
+ size_t y;
+ } shape;
+} t_ftmmat;
+
+t_ftmmat *ftm_matnew(size_t y, size_t x);
+void ftm_matdestroy(t_ftmmat *mat);
+t_ftmmat *ftm_matadd(t_ftmmat *dst, t_ftmmat *other);
+t_ftmmat *ftm_matsub(t_ftmmat *dst, t_ftmmat *other);
+t_ftmmat *ftm_matscale(t_ftmmat *dst, float scalar);
+t_ftmmat *ftm_matmul(t_ftmmat *dst, t_ftmmat *other);
+t_ftmvec *ftm_matmulvec(t_ftmmat *mat, t_ftmvec *dst);
+float ftm_matat(t_ftmmat *mat, size_t y, size_t x);
+
+#endif
diff --git a/vendor/libftm/inc/libftm_vec3.h b/vendor/libftm/inc/libftm_vec.h
index fc86dcb..805cb25 100644
--- a/vendor/libftm/inc/libftm_vec3.h
+++ b/vendor/libftm/inc/libftm_vec.h
@@ -1,31 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
-/* libftm_vec3.h :+: :+: :+: */
+/* libftm_vec.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
-/* Created: 2020/05/09 20:38:30 by charles #+# #+# */
-/* Updated: 2020/05/09 21:12:05 by charles ### ########.fr */
+/* Created: 2020/05/11 13:27:54 by charles #+# #+# */
+/* Updated: 2020/05/11 13:28:27 by charles ### ########.fr */
/* */
/* ************************************************************************** */
-#ifndef LIBFTM_VEC3_H
-# define LIBFTM_VEC3_H
+#ifndef LIBFTM_VEC_H
+# define LIBFTM_VEC_H
+
+# include <stdlib.h>
+# include <stddef.h>
/*
-** \brief 3 component vector [x, y, z]
+** \brief component vector [x, y, z]
*/
-typedef struct
+typedef struct s_ftmvec
{
- float v[3];
-} t_ftmvec3;
+ float *v;
+ size_t size;
+} t_ftmvec;
-t_ftmvec3 *ftm_vec3add(t_ftmvec3 *dst, t_ftmvec3 *other);
-t_ftmvec3 *ftm_vec3sub(t_ftmvec3 *dst, t_ftmvec3 *other);
-float ftm_vec3dot(t_ftmvec3 *a, t_ftmvec3 *b);
-void ftm_vec3cross(t_ftmvec3 *dst, t_ftmvec3 *a, t_ftmvec3 *b);
-t_ftmvec3 *ftm_vec3scale(t_ftmvec3 *dst, float scalar);
+t_ftmvec *ftm_vecnew(size_t size);
+void ftm_vecdestroy(t_ftmvec *vec);
+t_ftmvec *ftm_vecadd(t_ftmvec *dst, t_ftmvec *other);
+t_ftmvec *ftm_vecsub(t_ftmvec *dst, t_ftmvec *other);
+float ftm_vecdot(t_ftmvec *a, t_ftmvec *b);
+t_ftmvec *ftm_veccross(t_ftmvec *a, t_ftmvec *b);
+t_ftmvec *ftm_vecscale(t_ftmvec *dst, float scalar);
#endif
diff --git a/vendor/libftm/inc/libftm_vec4.h b/vendor/libftm/inc/libftm_vec4.h
deleted file mode 100644
index e89bd89..0000000
--- a/vendor/libftm/inc/libftm_vec4.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* ************************************************************************** */
-/* */
-/* ::: :::::::: */
-/* libftm.h :+: :+: :+: */
-/* +:+ +:+ +:+ */
-/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
-/* +#+#+#+#+#+ +#+ */
-/* Created: 2020/05/09 20:48:30 by charles #+# #+# */
-/* Updated: 2020/05/09 21:11:12 by charles ### ########.fr */
-/* */
-/* ************************************************************************** */
-
-#ifndef LIBFTM_VEC4_H
-# define LIBFTM_VEC4_H
-
-/*
-** \brief 4 component vector [x, y, z, w]
-*/
-
-typedef struct
-{
- float v[4];
-} t_ftmvec4;
-
-t_ftmvec4 *ftm_vec4add(t_ftmvec4 *dst, t_ftmvec4 *other);
-t_ftmvec4 *ftm_vec4sub(t_ftmvec4 *dst, t_ftmvec4 *other);
-float ftm_vec4dot(t_ftmvec4 *a, t_ftmvec4 *b);
-t_ftmvec4 *ftm_vec4scale(t_ftmvec4 *dst, float scalar);
-
-#endif