3Д БУМ

3Д принтеры и всё что с ними связано

The Dot (or Scalar) Product

The dot product can be used to find the angle between two vectors and is a quick test to determine whether two vectors are orthogonal (at right angles to each other). This can be useful in 3D programming if you need to find the final direction and speed of an object that has wind, gravity, or other forces acting upon it. You would only need to know the direction and magnitude of the forces, and the direction the object would move without the extra force acting on it.

Two vectors are orthogonal to each other if their dot product is zero. The dot product is defined in two ways. The first is uv = llull*llvll*cos0. The second way is uv = i1i2 + j1j2 … n1n2. All this means is that you multiply each of the vector components in the first vector by the corresponding component in the second vector, and then add all the results. The first equation (uv = llull*llvll*cos0) is used when you only know the magnitudes and angle between the two vectors, but may not

know the actual values of each component. The second equation (uv = i1i2 + j1j2 … n1n2) is used when you do not know the angle between your two vectors, only the vector’s components. So now how do you use those definitions to find the angle between your two vectors? Simple, you just call up your algebra and trig skills and solve the first equation for theta, which stands for the angle between the vectors. This is done for you in Figure 1.20. As always an example is shown as well.

U* V = Ii/llv1cos0

в = arccos

ЛтмЛ

u\v I

The Dot (or Scalar) Product

(

)

49.4°

\^7×2’/5

1 x 4 + 4 x 2

в = arccos

Figure 1.20 Calculating the angle between two vectors, don’t forget to use the second definition for the dot product. The first part shows the equation for the dot product solved for theta (the angle between the two vectors). Don’t forget that ||v|| means the magnitude of v. The second part shows the calculations involved in calculating the angle between two vectors using the vectors <1,4> and <4,2>.

S/1"

Для любых предложений по сайту: [email protected]