Problem Statement
vectors in space
Write a program that prompts the user to enter two points v=(v1,v2,v3) and w=(w1,w2,w3) in
three-space. The program then computes the lengths of the vectors ov,ow, and vw; the dot product
of ov and ow; the angle between ov and ow; and the cross product ov and ow, where o is the origin.
The vector ab is a vector from point a to point b. Represent the points and vectors using structures
. Write functions to compute length, dot , angle and cross product which takes two vectors as
input and prints the result.
Example Run
Enter a point v
x coordinate of v = 2
y coordinate of v = 3
z coordinate of v = 5
Enter a point w
x coordinate of w = 2
y coordinate of w = 2
z coordinate of w = 4
length of ov = 6.16
length of ow = 4.90
length of vw = 1.41
dot product of ov and ow is 30
angle between ov and ow is 0.110 radians
cross product of ov and ow is (2,2,-2)
Hint
cross product of ov and ow is (v2w3-v3w2,v3w1-v1w3,v1w2-v2w1)
cos (angle) = (ov.ow)/|ov||ow|