summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-10-02 20:46:39 +0000
committerrodri <rgl@antares-labs.eu>2024-10-02 20:46:39 +0000
commit0abc1ca44de64a689f5877e4b7e194c43a1ddcd8 (patch)
tree8262ecd3ad2f3a53be7bcbfcd813cfeec71ad714 /util.c
parentb6a336aff26fbc94e7803719a8aeb8fa29eddb9b (diff)
downloadlibgraphics-0abc1ca44de64a689f5877e4b7e194c43a1ddcd8.tar.gz
libgraphics-0abc1ca44de64a689f5877e4b7e194c43a1ddcd8.tar.bz2
libgraphics-0abc1ca44de64a689f5877e4b7e194c43a1ddcd8.zip
shorten Shadertab prop names. add quaternion sandwich product utils.
Diffstat (limited to 'util.c')
-rw-r--r--util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/util.c b/util.c
index ff76ab9..8aeaaf2 100644
--- a/util.c
+++ b/util.c
@@ -91,6 +91,21 @@ eqpt3(Point3 a, Point3 b)
return vec3len(subpt3(a, b)) < ε2;
}
+Quaternion
+qsandwich(Quaternion q, Quaternion p)
+{
+ return mulq(mulq(q, p), invq(q));
+}
+
+Point3
+qsandwichpt3(Quaternion q, Point3 p)
+{
+ Quaternion r;
+
+ r = qsandwich(q, Quatvec(0, p));
+ return Pt3(r.i, r.j, r.k, p.w);
+}
+
void
memsetf(void *dp, float v, usize len)
{