Skip to content

Instantly share code, notes, and snippets.

@keijiro
Created October 30, 2017 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keijiro/454c349df6e7effc44eb6dec6813dd60 to your computer and use it in GitHub Desktop.
Save keijiro/454c349df6e7effc44eb6dec6813dd60 to your computer and use it in GitHub Desktop.
float3x3 Euler3x3(float3 v)
{
float sx, cx;
float sy, cy;
float sz, cz;
sincos(v.x, sx, cx);
sincos(v.y, sy, cy);
sincos(v.z, sz, cz);
float3 row1 = float3(sx*sy*sz + cy*cz, sx*sy*cz - cy*sz, cx*sy);
float3 row3 = float3(sx*cy*sz - sy*cz, sx*cy*cz + sy*sz, cx*cy);
float3 row2 = float3(cx*sz, cx*cz, -sx);
return float3x3(row1, row2, row3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment