Sign in to follow this  
MrPickle

Rotating a vector

Recommended Posts

I have 2 vectors, a which intercepts with c. I am trying to find the vector b (See picture) Here's what I'm doing atm: θ = cos-1 ((a.c)/|a||c|) let x = ax and y = ay bx = x*cosθ - y*sinθ by = x*sinθ + y*cosθ but this isn't giving me the expected results?

Share this post


Link to post
Share on other sites
Sorry for the very brief reply, don't have much time.

I'm assuming you are working in 2 dimensions. If so then first calculate the vector normal to C. This can be done using the formula: Cnorm = (-y, x), if C=(x,y). Normalize Cnorm.

Then the vector b is given by:

b = a - 2*(a.Cnorm)*Cnorm

Hope this helps.

Share this post


Link to post
Share on other sites
Yes, I am working in 2D.
I fixed (I think) my method by using π-2θ instead of θ when calculating b.

Could somebody explain Weasa's method please?

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

Sign in to follow this