Jump to content

How to rotate a vector to make it tangent

Recommended Posts

You can do this with two cross products.

First you take the normal, and cross it with v to get a vector orthogonal to both N and v. Then you cross that vector with N again, to get your original vector, but now orthogonal to both N and the other vector you already generated; this means it'll be tangent to your sphere.

vector tmp = cross(v@v, v@N);
v@v = cross(tmp, v@N);

Also, make sure your v@v attribute you're creating has three components, not two.

Share this post

Link to post
Share on other sites

Thank you very much.
I was able to create the vector that I wanted.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now