redpeak Posted May 12, 2020 Share Posted May 12, 2020 I created @v, which is a random vector in sphere. How do I rotate this vector to make it tangent to the sphere? Thanks! rotate_vector.hiplc Quote Link to comment Share on other sites More sharing options...
toadstorm Posted May 13, 2020 Share Posted May 13, 2020 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. Quote Link to comment Share on other sites More sharing options...
redpeak Posted May 13, 2020 Author Share Posted May 13, 2020 Thank you very much. I was able to create the vector that I wanted. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.