Skip to content

Instantly share code, notes, and snippets.

@yiwenl
Created November 13, 2019 21:17
Embed
What would you like to do?
vec3 align(vec3 pos, vec3 dir) {
vec3 initDir = vec3(1.0, 0.0, 0.0);
vec3 axis = cross(dir, initDir);
float angle = acos(dot(dir, initDir));
return rotate(pos, axis, angle);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment