Problem 635. Angle between Two Vectors
The dot product relationship, a dot b = | a | | b | cos(theta), can be used to determine the acute angle between vector a and vector b ( 0 to pi ).
The definition of | a | is ( a(1)a(1)+a(2)a(2)...+a(n)a(n) )^0.5.
The definition of "a dot b" is a(1)b(1)+a(2)b(2)...+a(n)b(n). (wikipedia)
In 3-D the angle is in the plane created by the vectors a and b.
The input may be a 2-D or a 3-D vector. These represent physical models.
An extension of this angular determination given vectors problem is to provide two points for each vector. The practical application relates to Laser Trackers which best fit multiple points for lines, surfaces, annular surfaces, and other reference points.
Examples:
a=[1 0] (x-axis); b=[0 1] (y-axis) which intersect at 90 degrees (pi/2)
theta=acos(a dot b/(|a||b|)=acos(0/(1*1))=pi/2 radians
a=[1 1 0] 45 degrees in xy plane b=[1 1 1.414] 45 degree vector in Z above a 45 degree rotation in XY plane.
theta=acos(a dot b/(|a||b|)=acos(2/(1.414*2))=pi/4 radians
Solution Stats
Problem Comments
-
1 Comment
Spookily similar to Problem 381 ("Angle between two vectors")....
Solution Comments
Show commentsGroup

Computational Geometry I
- 20 Problems
- 107 Finishers
- Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
- Calculate the area of a triangle between three points
- Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
- Television Screen Dimensions
- Find third Side of a right triangle given hypotenuse and a side. No * - or other functions allowed
- Calculate the area of a triangle between three points
- Are all the three given point in the same line?
- Volume of a Parallelepiped
- Spherical radius given four points
- Angle between Two Vectors
- Is the Point in a Circle?
- What is the distance from point P(x,y) to the line Ax + By + C = 0?
- Covering area
- Clock Hand Angle 1
- Angle between two vectors
- Similar Triangles - find the height of the tree
- Circumscribed circles
- Are you in or are you out?
- Clockwise or Counterclockwise
- Smallest distance between a point and a rectangle
- Great Circle Distance
- Right and wrong
Problem Recent Solvers512
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!