- C++ Game Development By Example
- Siddharth Shekar
- 328字
- 2021-06-24 14:26:15
Dot product
A dot product is a type of vector multiplication in which the resultant vector is a scalar. It is also referred to as a scalar product for the same reason. Scalar product of two vectors is the sum of the products of the corresponding components.
If you have two vectors A = (ax, ay, az) and B = (bx, by, bz), then is given as:
= ax ×bx + ay × by + az ×bz --- (1)
The dot product of two vectors is also equal to the cosine of the angle between the vectors multiplied by the magnitudes of both vectors. Notice the dot product is represented as a dot between the vector.


θ is always between 0 and π. By putting an equation of 1 and 2 together, we can figure out the angle between 2 vectors:
*
)
Consequently,
This form has some unique geometric properties:
If = 0 then
is perpendicular to
as cos 90 = 0.
=
then the 2 vectors are parallel to each other as cos 0 = 1.
If > 0 then the angle between the vectors is less than 90 degrees.
If < 0 then the angle between the vectors is greater than 90 degrees.
Let us see an example of a dot product:
If = (3, -5, 7) and
= (2, 4 , 1)
Then = 9.110 and

Next, we calculate = ax *bx + ay * by + az * bz
= 3 * 2 + (-5) * 4 + 7 * 1
= 6 - 20 + 7
= -7
cos θ = -7/ (9.110 * 4.582) = -7/ 41.74
θ = cos-1(-7/41.74) = cos-1(0.26770) = 99.65° (approx)
- Arduino入門基礎(chǔ)教程
- Cortex-M3 + μC/OS-II嵌入式系統(tǒng)開發(fā)入門與應(yīng)用
- Windows phone 7.5 application development with F#
- 深入淺出SSD:固態(tài)存儲核心技術(shù)、原理與實(shí)戰(zhàn)
- Deep Learning with PyTorch
- 計算機(jī)組裝·維護(hù)與故障排除
- Hands-On Artificial Intelligence for Banking
- 深入理解序列化與反序列化
- LPC1100系列處理器原理及應(yīng)用
- 筆記本電腦芯片級維修從入門到精通(圖解版)
- The Artificial Intelligence Infrastructure Workshop
- FPGA實(shí)戰(zhàn)訓(xùn)練精粹
- 從企業(yè)級開發(fā)到云原生微服務(wù):Spring Boot實(shí)戰(zhàn)
- ActionScript Graphing Cookbook
- 新編計算機(jī)組裝與維護(hù)