• Advertisement
Sign in to follow this  

Rotating a vector

This topic is 2858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
See this article for details. Note that the reflection normal n is your c-vector, rotated 90 degrees.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement