summaryrefslogtreecommitdiff
path: root/include/cglm/struct/curve.h
diff options
context:
space:
mode:
authorAaditya Dhruv <[email protected]>2026-01-25 15:10:37 -0600
committerAaditya Dhruv <[email protected]>2026-01-25 15:10:37 -0600
commit118980e02e59ff31871df59dce257075394f3533 (patch)
tree26fba4492bb4b561d21bf49b35d892a821d54fab /include/cglm/struct/curve.h
parent0e6e1245b70df4dfcba135d50e1b53d1a8ef7eb8 (diff)
wip
Diffstat (limited to 'include/cglm/struct/curve.h')
-rw-r--r--include/cglm/struct/curve.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/cglm/struct/curve.h b/include/cglm/struct/curve.h
new file mode 100644
index 0000000..53ea359
--- /dev/null
+++ b/include/cglm/struct/curve.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c), Recep Aslantas.
+ *
+ * MIT License (MIT), http://opensource.org/licenses/MIT
+ * Full license can be found in the LICENSE file
+ */
+
+#ifndef cglms_curves_h
+#define cglms_curves_h
+
+#include "../common.h"
+#include "../types-struct.h"
+#include "../curve.h"
+#include "vec4.h"
+#include "mat4.h"
+
+/*!
+ * @brief helper function to calculate S*M*C multiplication for curves
+ *
+ * This function does not encourage you to use SMC,
+ * instead it is a helper if you use SMC.
+ *
+ * if you want to specify S as vector then use more generic glm_mat4_rmc() func.
+ *
+ * Example usage:
+ * B(s) = glm_smc(s, GLM_BEZIER_MAT, (vec4){p0, c0, c1, p1})
+ *
+ * @param[in] s parameter between 0 and 1 (this will be [s3, s2, s, 1])
+ * @param[in] m basis matrix
+ * @param[in] c position/control vector
+ *
+ * @return B(s)
+ */
+CGLM_INLINE
+float
+glms_smc(float s, mat4s m, vec4s c) {
+ return glm_smc(s, m.raw, c.raw);
+}
+
+#endif /* cglms_curves_h */