Relative orientation of two vectors

In summary, the conversation discusses methods for determining if two objects are facing each other on a 2D plane and calculating a parameter to measure the extent to which they are facing each other. The suggested solutions include using the inner product, cosine function, and distance method. The conversation also suggests defining the concept of "facing" more precisely to find a more suitable solution.
  • #1
xonxt
3
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
  • #2
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

[tex]\cos(\alpha) = \frac{\mathbf{v}\cdot \mathbf{w}}{\|\mathbf{v}\|\|\mathbf{w}\|}[/tex]

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

[tex]\mathbf{v}\cdot \mathbf{w} = 1\cdot 5 + 2\cdot 1 + 3\cdot 2 = 13[/tex]

Thus

[tex]\cos(\alpha) = \frac{13}{\sqrt{14}\sqrt{30}}[/tex]

For more information, see "Introduction to Linear Algebra" by Serge Lang.
 
  • #3
The example you show is confusing. For all your cases the vectors are in opposite direction.
 
  • #4
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:

[tex]X = \frac{180 - |\alpha - \beta|}{180}[/tex]

I will only get a X = [0; 1] that way, but it's a start.
 
  • #5
[itex]\cos(\alpha - \beta)[/itex] 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 [itex]-\cos(\alpha - \beta)[/itex]
 
  • #6
gerben said:
[itex]\cos(\alpha - \beta)[/itex] 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 [itex]-\cos(\alpha - \beta)[/itex]

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
 
  • #7
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)
 
  • #8
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?
 
  • #9
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
 

Related to Relative orientation of two vectors

1. What is the relative orientation of two vectors?

The relative orientation of two vectors refers to the direction in which the vectors are pointing in relation to each other. It can be described as either parallel, anti-parallel, or perpendicular.

2. How is the relative orientation of two vectors determined?

The relative orientation of two vectors can be determined by calculating the dot product of the two vectors. If the dot product is positive, the vectors are parallel or pointing in the same direction. If the dot product is negative, the vectors are anti-parallel or pointing in opposite directions. If the dot product is zero, the vectors are perpendicular.

3. Can the relative orientation of two vectors change?

Yes, the relative orientation of two vectors can change if the vectors are rotated or if their magnitudes are changed. However, the relative orientation will remain the same if the vectors are scaled by a constant factor.

4. How does the relative orientation of two vectors affect their resultant vector?

The relative orientation of two vectors affects their resultant vector by determining the magnitude and direction of the resultant vector. If the vectors are parallel, the resultant vector will have a larger magnitude. If the vectors are anti-parallel, the resultant vector will have a smaller magnitude. If the vectors are perpendicular, the resultant vector will be zero.

5. What are some real-world applications of understanding relative orientation of two vectors?

Understanding the relative orientation of two vectors is important in many fields such as physics, engineering, and navigation. It is used in calculating forces, determining the direction of motion, and navigating using GPS coordinates. It is also essential in understanding the behavior of electromagnetic fields and light waves.

Similar threads

  • General Math
Replies
13
Views
2K
Replies
9
Views
1K
  • General Math
Replies
20
Views
1K
Replies
3
Views
385
  • General Math
Replies
11
Views
1K
Replies
2
Views
1K
Replies
1
Views
638
Replies
2
Views
1K
Replies
3
Views
1K
Back
Top