diff options
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). |
