Lesson 1 of 18
3D Dot Product
The Dot Product in 3D
The dot product of two vectors and is:
The result is a scalar — a single number, not a vector.
Geometric Interpretation
Where is the angle between the vectors. This means:
- If : vectors point in a similar direction ()
- If : vectors are perpendicular ()
- If : vectors point in opposite directions ()
Applications
- Checking orthogonality: two vectors are perpendicular if and only if their dot product is zero
- Work: (force dot displacement)
- Projections: computing how much one vector points along another
Examples
| (1,0,0) | (0,1,0) | 0 (perpendicular) |
| (1,2,3) | (4,5,6) | 4+10+18 = 32 |
| (2,2,1) | (2,2,1) | $4+4+1 = 9 = |
Your Task
Implement double dot3(double ax, double ay, double az, double bx, double by, double bz) that computes the 3D dot product.
TCC compiler loading...
Loading...
Click "Run" to execute your code.