Angle between 2 vectors in a certain direction

  • #1
Hi all,

I want to implement diffraction of waves by edges. I have a wedge with 2 faces o-face and n-face. I have the tangent and normal of each face.

Assume the angle between the 2 faces is alpha where alpha is the outer angle (> 180).

I have an incident vector, passing through the edge though the outer angle (alpha)

I want the angle between the incident vector and the o-face in the same direction as alpha (i.e. without crossing n-face).

In the normal circumstances, I would thus use the dot product and get the cosine of the angle between them.

But the problem is that in some cases the angle is greater than 180 and in other it is not. How can I determine this? The dot product only gets angles [0, 180].

Thanks in advance
  • #2
Try thinking about it this way: Imagine that both faces are infinite planes in 3-space (which you can define with your normal vectors and some point on each plane). Start at some point on one plane and trace a ray in the direction of the plane normal. Assuming that your normal vectors will always face away from the wedge (out from the face, not in towards it), the ray will always intersect the opposite plane when the angle is > 180 deg., and it will never intersect it when the angle is < 180 deg.

Does this help? I know I used a lot of words to say this, but I think the math will be fairly easy.

Hope this helps,

  • #3
I was thinking about this last night, and I realized that what I posted was incorrect... I was only considering angles in two of the four quadrants. There might still be some way to use this approach, but it is not perfect.

This might be better: If the normal vectors are "pointed towards each other," the angle is < 180, if they are "pointed away from each other," the angle is > 180. Maybe looking at the result of a cross product between the two normal vectors can give some indication? If you've got two normals, and you cross them, you'll get some vector. If you flip one of them so it's going in the opposite direction, the cross product will give you a vector that lies on the same line as the first, but in the opposite direction, right?

  • #4
Thanks a lot for replying to my question

I think I figured it out.

I can divide the space I have into 4 regions:
1- The interior of the wedge (marked by the two tangents with both of them pointing away from the edge)
2- The opposite region of the interior region and it is marked by the opposite direction of the tangents
3- The region between the first face and the opposite to the tangent of the second face
4- The region between the second face and the opposite to the tangent of the first face

I know the interior angle of the wedge. I can use this info to determine the region of incidence as follows:
1- I'm sure the ray would never be incident from the first region
2- For the second region, I get the angle between the ray and the tangents to both faces (both pointing away from the edge). If the ray truly lies in this region, both angles should be obtuse and their sum should be equal to 360 - the interior angle.
3- For the third region, I get the angle between the ray and the tangent of the first face, and the angle between the ray and the opposite to the tangent of the second face. I add 180 to the second angle to get the angle between the ray and the tangent to the second face. If the sum of these angles equals 360 - the interior angle then the ray lies in this region.
4- The fourth region is similar to the third region but with the opposite faces.

Once I determine the region, I can get the angle with any of the faces because I now know when to add 180 or not.

Suggested for: Angle between 2 vectors in a certain direction