Relative orientation of two vectors

Click For Summary

Discussion Overview

The discussion revolves around determining the relative orientation of two objects on a 2D plane based on their facing angles. Participants explore methods to quantify how much the objects are facing each other, including mathematical approaches and conceptual definitions of "facing." The scope includes theoretical reasoning and mathematical modeling.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant asks how to determine if two objects are facing each other and suggests a parameter to quantify this relationship.
  • Another participant proposes using the inner product of vectors to find the cosine of the angle between them, suggesting that this could help determine their relative orientation.
  • Some participants express confusion over the examples provided, noting that the vectors appear to be in opposite directions.
  • A participant suggests a simpler approach using angles directly, proposing a formula to calculate a parameter X based on the difference between the angles.
  • Another participant discusses the properties of cosine in relation to the angles, indicating that it can provide information about the directionality of the vectors.
  • There is a suggestion to define what "facing" means more precisely to facilitate finding a solution.
  • One participant mentions using a distance method to determine if the objects are facing each other based on the distance between their respective facing points.

Areas of Agreement / Disagreement

Participants express differing views on the best method to determine if the objects are facing each other, with no consensus reached on a single approach. There are multiple competing ideas regarding the definitions and calculations involved.

Contextual Notes

Some participants note limitations in the examples provided, particularly regarding the clarity of the cases presented and the definitions of "facing." There is also a mention of the need for precise definitions to avoid ambiguity in the discussion.

xonxt
Messages
3
Reaction score
0
Hello. I'm sorry if this is a really trivial question, but I'm not that good with vector arithmetics, so I have to ask.

Let's say I have two objects on a 2D plane, that face some direction. I have (x,y) coordinates of each object, and I have an angle each object is facing. The relative coordinates are not important to me, what I need to find out, is if the objects are facing each other, and to compute some parameter X which, for lack of better terms, tells me how "much" are they facing each other. A relative angle, if you wish.
Here's an illustration of what I need, approximately:
1373921244-new-canvas-83kb.png


Does a thing like that exist, or do I need to invent it? :D
 
Mathematics news on Phys.org
The inner product should be what you're looking for.

Given two vectors ##\mathbf{v}## and ##\mathbf{w}## (both emanating from the origin). Then you have

\cos(\alpha) = \frac{\mathbf{v}\cdot \mathbf{w}}{\|\mathbf{v}\|\|\mathbf{w}\|}

For example, given ##\mathbf{v} = (1,2,3)## and ##\mathbf{w} = (5,1,2)##, then

\mathbf{v}\cdot \mathbf{w} = 1\cdot 5 + 2\cdot 1 + 3\cdot 2 = 13

Thus

\cos(\alpha) = \frac{13}{\sqrt{14}\sqrt{30}}

For more information, see "Introduction to Linear Algebra" by Serge Lang.
 
The example you show is confusing. For all your cases the vectors are in opposite direction.
 
mathman said:
The example you show is confusing. For all your cases the vectors are in opposite direction.
Well, maybe I phrased it wrong. Would it help, if I told you that it is a computer vision problem. I have computed the angle two objects are facing, now I need know if these two objects are facing towards or away from each other?

micromass said:
The inner product should be what you're looking for.
I was thinking of something more simple. First of all, I son't have vector coordinates, I only have angles.
Secondly, I thought along the lines of something like this:

X = \frac{180 - |\alpha - \beta|}{180}

I will only get a X = [0; 1] that way, but it's a start.
 
\cos(\alpha - \beta) is 1 when they are in the same direction and -1 when they are in opposite direction. When they are somewhat in the same direction it is smaller than 1 but still positive (the smaller the less they are in the same direction) and when they are somewhat in the opposite direction it is larger than -1 but still negative. So, for what you want you could use -\cos(\alpha - \beta)
 
gerben said:
\cos(\alpha - \beta) is 1 when they are in the same direction and -1 when they are in opposite direction. When they are somewhat in the same direction it is smaller than 1 but still positive (the smaller the less they are in the same direction) and when they are somewhat in the opposite direction it is larger than -1 but still negative. So, for what you want you could use -\cos(\alpha - \beta)

Well, that's almost what I'm looking for. The only downside is with that I can only determine if both vectors are directed somewhat along one line, but it doesn't show me if they are facing inwards or outwards.
Basically here is what we get. Cases A and B are similar and we don't get any information whether they're facing each other or not:
1373926137-clip-33kb.jpg
 
The way you drew it case A and case B are the same, (about) the same angle alpha and beta (alpha around 200 degrees and beta around 45 degrees) and since they are somewhat opposite you get a positive number. In case C you will also get a positive number, it is about -cos(100 - 250)
 
Maybe start with the easier problem of determining if one of the objects is facing the other. Also, you might want to think about precisely defining "facing", keeping in mind that you'd like to permit different degrees of "facing". Sometimes writing down exactly what you're trying to do leads to a fairly obvious solution. If you can define what you mean by "A is facing B", then "A and B are facing each other" should mean "A is facing B and B is facing A", right?
 
I find using dot product most convenient but it's up to you. If the object is facing each other exactly then their dot product will be -1.

Using distance method to decide if they're facing opposite each other or face-to-face: Imagine there's a point on the object face vector. Calculate the distance between that point with the second object face vector point. If they're facing outward, then the distance between those two points will be larger then the relative distance between the center of the objects. If they're facing inwards the distance will be less than it.

PxZFUlu.png
 

Similar threads

  • · Replies 23 ·
Replies
23
Views
2K
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 24 ·
Replies
24
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K