Skip to content

Instantly share code, notes, and snippets.

@supahfunk
Created January 3, 2021 13:55
Show Gist options
  • Select an option

  • Save supahfunk/047f78d22cb7f05a0621d0b3026ee3de to your computer and use it in GitHub Desktop.

Select an option

Save supahfunk/047f78d22cb7f05a0621d0b3026ee3de to your computer and use it in GitHub Desktop.
vec3 rotateAxis(vec3 p, vec3 axis, float angle) {
return mix(dot(axis, p)*axis, p, cos(angle)) + cross(axis,p)*sin(angle);
}
// pos = rotateAxis(pos, vec3(1., 0., 0.), PI * .5); // => Rotate X Axis 180deg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment