S.O.S. Mathematics CyberBoard

Your Resource for mathematics help on the web!
 It is currently Thu, 20 Jun 2013 04:52:50 UTC

 All times are UTC [ DST ]

 Page 1 of 2 [ 16 posts ] Go to page 1, 2  Next
 Print view Previous topic | Next topic
Author Message
 Post subject: Sign of angle between vectorsPosted: Fri, 6 Jan 2012 20:00:26 UTC
 Senior Member

Joined: Mon, 2 May 2005 19:58:46 UTC
Posts: 86
Say I have a 2D vector connecting two points and . The midpoint of the vector, , is connected to another point , which is not collinear with and .

If I rotate by an angle , where , then has the same direction as . (Similarly, if I rotate in the other direction by an angle then has the same direction as .)

I can figure out using the dot product of and . My question is, how do I figure out if is in the clockwise or counterclockwise direction?

Top

 Post subject: Re: Sign of angle between vectorsPosted: Fri, 6 Jan 2012 21:44:53 UTC
 Moderator

Joined: Wed, 30 Mar 2005 04:25:14 UTC
Posts: 12172
Location: Austin, TX
DannyBoy wrote:
Say I have a 2D vector connecting two points and . The midpoint of the vector, , is connected to another point , which is not collinear with and .

If I rotate by an angle , where , then has the same direction as . (Similarly, if I rotate in the other direction by an angle then has the same direction as .)

I can figure out using the dot product of and . My question is, how do I figure out if is in the clockwise or counterclockwise direction?

A priori you cannot tell, because it will depend on an orientation, which you haven't chosen.

If you are using the standard orientation, you should be able to convince yourself that you STILL cannot tell because cosine is an even function, so the dot product doesn't care if it's positive or negative.

_________________
(\ /)
(O.o)
(> <)
This is Bunny. Copy Bunny into your signature to help him on his way to world domination

Top

 Post subject: Re: Sign of angle between vectorsPosted: Fri, 6 Jan 2012 21:52:24 UTC
 Senior Member

Joined: Mon, 2 May 2005 19:58:46 UTC
Posts: 86
Thanks for the reply, Shadow! I guess that's my point: the dot product cannot tell me the direction, so how do I find out?

Top

 Post subject: Re: Sign of angle between vectorsPosted: Fri, 6 Jan 2012 22:06:36 UTC
 Moderator

Joined: Wed, 30 Mar 2005 04:25:14 UTC
Posts: 12172
Location: Austin, TX
DannyBoy wrote:
Thanks for the reply, Shadow! I guess that's my point: the dot product cannot tell me the direction, so how do I find out?

If all you know is the dot product, you cannot find out. Even if you know one of the vectors you cannot figure that out, because all the dot product does is tell you how much of one vector is in the direction of the other, so you can get the direction of the other vector if you know one and you know their dot product, but that's about it.

To see this note if one vector has components known and the other has components unknown and you have their dot product is c, then all you know is , i.e. what line your other vector lies on.

_________________
(\ /)
(O.o)
(> <)
This is Bunny. Copy Bunny into your signature to help him on his way to world domination

Top

 Post subject: Re: Sign of angle between vectorsPosted: Fri, 6 Jan 2012 22:24:03 UTC
 Senior Member

Joined: Mon, 2 May 2005 19:58:46 UTC
Posts: 86
Thanks again for the reply, Shadow. Perhaps I'm not articulating myself very well: I know both vectors.

In short, if I have two vectors, how do I determine which direction to rotate one of these vectors such that it points the same way as the other vector providing I rotate it through the smallest angle possible?

Top

 Post subject: Re: Sign of angle between vectorsPosted: Fri, 6 Jan 2012 22:32:22 UTC
 Moderator

Joined: Wed, 30 Mar 2005 04:25:14 UTC
Posts: 12172
Location: Austin, TX
DannyBoy wrote:
Thanks again for the reply, Shadow. Perhaps I'm not articulating myself very well: I know both vectors.

In short, if I have two vectors, how do I determine which direction to rotate one of these vectors such that it points the same way as the other vector providing I rotate it through the smallest angle possible?

Oh, that's easy. Just look at the orientation between them, if C is to the right of the line through A and B, then go clockwise, if not go counterclockwise, draw a picture of both situations and you should be able to see why this is.

_________________
(\ /)
(O.o)
(> <)
This is Bunny. Copy Bunny into your signature to help him on his way to world domination

Top

 Post subject: Re: Sign of angle between vectorsPosted: Mon, 9 Jan 2012 15:47:37 UTC
 Senior Member

Joined: Mon, 2 May 2005 19:58:46 UTC
Posts: 86
But how do I do it mathematically? I have around half a million cases to consider, so would prefer not to draw pictures for each!

Top

 Post subject: Re: Sign of angle between vectorsPosted: Mon, 9 Jan 2012 19:34:27 UTC
 Senior Member

Joined: Mon, 2 May 2005 19:58:46 UTC
Posts: 86
Okay, here's my attempted solution. Assuming two 2D vectors, and , the direction of smallest necessary rotation needed for to align with can be determined as follows.

Counterclockwise if or
Clockwise if or
Neither if
Either if or

Top

 Post subject: Re: Sign of angle between vectorsPosted: Mon, 9 Jan 2012 20:15:20 UTC
 Moderator

Joined: Wed, 30 Mar 2005 04:25:14 UTC
Posts: 12172
Location: Austin, TX
DannyBoy wrote:
But how do I do it mathematically? I have around half a million cases to consider, so would prefer not to draw pictures for each!

You said you know the vectors, look at their coordinates.

_________________
(\ /)
(O.o)
(> <)
This is Bunny. Copy Bunny into your signature to help him on his way to world domination

Top

 Post subject: Re: Sign of angle between vectorsPosted: Mon, 9 Jan 2012 20:18:58 UTC
 Senior Member

Joined: Mon, 2 May 2005 19:58:46 UTC
Posts: 86
Is there a more efficient way of determining the direction from the coordinates than my solution, which seems rather clunky?

Top

 Post subject: Re: Sign of angle between vectorsPosted: Mon, 9 Jan 2012 20:47:48 UTC
 Moderator

Joined: Wed, 30 Mar 2005 04:25:14 UTC
Posts: 12172
Location: Austin, TX
Probably, but I personally don't see why, you asked how to do it, and that works, so why rock the boat?

_________________
(\ /)
(O.o)
(> <)
This is Bunny. Copy Bunny into your signature to help him on his way to world domination

Top

 Post subject: Re: Sign of angle between vectorsPosted: Mon, 9 Jan 2012 20:56:00 UTC
 Senior Member

Joined: Mon, 2 May 2005 19:58:46 UTC
Posts: 86
Because I have to perform the operations around half a million times in an R program, so the more efficient the solution, the faster my code will run.

Top

 Post subject: Re: Sign of angle between vectorsPosted: Tue, 10 Jan 2012 14:18:43 UTC
 Moderator

Joined: Mon, 29 Dec 2008 17:49:32 UTC
Posts: 6068
Location: 127.0.0.1, ::1 (avatar courtesy of UDN)
DannyBoy wrote:
Because I have to perform the operations around half a million times in an R program, so the more efficient the solution, the faster my code will run.

You need only the sign of , where . However, note the subtraction of possibly nearly equal quantity.

_________________

Top

 Post subject: Re: Sign of angle between vectorsPosted: Tue, 10 Jan 2012 14:47:25 UTC
 Senior Member

Joined: Mon, 2 May 2005 19:58:46 UTC
Posts: 86
Wow, very efficient! Thanks, outermeasure! So, your approach looks like the determinant of . Could you explain why it works or point me in the direction of a webpage?

Top

 Post subject: Re: Sign of angle between vectorsPosted: Tue, 10 Jan 2012 15:29:50 UTC
 Moderator

Joined: Mon, 29 Dec 2008 17:49:32 UTC
Posts: 6068
Location: 127.0.0.1, ::1 (avatar courtesy of UDN)
DannyBoy wrote:
Wow, very efficient! Thanks, outermeasure! So, your approach looks like the determinant of . Could you explain why it works or point me in the direction of a webpage?

You should know the signed area of triangle is (assuming usual orientation).

_________________

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 2 [ 16 posts ] Go to page 1, 2  Next

 All times are UTC [ DST ]

Who is online

Users browsing this forum: No registered users

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forum

Search for:
 Jump to:  Select a forum ------------------ High School and College Mathematics    Algebra    Geometry and Trigonometry    Calculus    Matrix Algebra    Differential Equations    Probability and Statistics    Proposed Problems Applications    Physics, Chemistry, Engineering, etc.    Computer Science    Math for Business and Economics Advanced Mathematics    Foundations    Algebra and Number Theory    Analysis and Topology    Applied Mathematics    Other Topics in Advanced Mathematics Other Topics    Administrator Announcements    Comments and Suggestions for S.O.S. Math    Posting Math Formulas with LaTeX    Miscellaneous