summaryrefslogtreecommitdiffstats
path: root/math.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2026-04-08 22:16:35 -0700
committeryum <yum.food.vr@gmail.com>2026-04-08 22:16:35 -0700
commit34f3001c0ae2ac20ad02f02434a2e13c50c8b6d8 (patch)
treed7babb9ad73910930eadb88e008524b84843315e /math.cginc
parentf8b7967fce24ac1678985f8e49288a1a3600ccae (diff)
add rotation to c31 hexagons
needs some cleanup but it's pretty efficient, at least
Diffstat (limited to 'math.cginc')
-rwxr-xr-xmath.cginc6
1 files changed, 6 insertions, 0 deletions
diff --git a/math.cginc b/math.cginc
index 15d02eb..ee70495 100755
--- a/math.cginc
+++ b/math.cginc
@@ -67,6 +67,12 @@ float3 rotate_vector(float3 v, float4 q)
return v + q.w * t + cross(q.xyz, t);
}
+float4 get_quaternion(float3 axis_normal, float theta) {
+ float sint2, cost2;
+ sincos(theta*0.5, sint2, cost2);
+ return float4(axis_normal * sint2, cost2);
+}
+
// Cartesian to packed cube hexagonal coordinates.
// Stores (q + r, q, r), where the article's cube coordinates satisfy
// q + r + s = 0 and s = -(q + r).