diff options
| author | yum <yum.food.vr@gmail.com> | 2026-04-08 22:16:35 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-04-08 22:16:35 -0700 |
| commit | 34f3001c0ae2ac20ad02f02434a2e13c50c8b6d8 (patch) | |
| tree | d7babb9ad73910930eadb88e008524b84843315e /math.cginc | |
| parent | f8b7967fce24ac1678985f8e49288a1a3600ccae (diff) | |
add rotation to c31 hexagons
needs some cleanup but it's pretty efficient, at least
Diffstat (limited to 'math.cginc')
| -rwxr-xr-x | math.cginc | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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). |
