I know that if you take the dot-product of two normalized vectors, you get the cosine of the angle between them.

But if I take the dot-product of two non-normalized vectors (or one normalized, one not), how can I interpret the resulting scalar?


3 Answers 3


Others have pointed out how you can use the sign of the dot product to broadly determine the angle between two arbitrary vectors (positive: < 90, zero: = 90, negative: > 90), but there's another useful geometric interpretation if at least one of the vectors is of length 1.

If you have one unit vector \$\hat U\$ and one arbitrary vector \$V\$, you can interpret the dot product as the length of the projection of \$V\$ onto \$\hat U\$:

diagram of a dot product with a unit vector

Equivalently, \$(\hat U \cdot V)\$ is the length of the component of \$V\$ pointing in the direction of \$\hat U\$. ie. You can break \$V\$ into a sum of two perpendicular vectors, \$V = (\hat U \cdot V) \hat U + P\$, where \$P\$ is some vector perpendicular to \$\hat U\$.

This is helpful for rewriting a vector from one coordinate system in terms of a different basis, or for removing/reflecting the component of a vector that's parallel to a particular direction while keeping the perpendicular component intact. (eg. zeroing the component of a velocity that would take an object through a barrier, but allowing it to slide along that barrier, or rebounding it away)

I'm not aware of a convenient geometric interpretation of the dot product when both vectors are of arbitrary length (other than using the sign to categorize the angle).

  • \$\begingroup\$ +1 for "If you have one unit vector U and one arbitrary vector V, you can interpret the dot product as the length of the projection of V onto U" \$\endgroup\$ Oct 23, 2015 at 17:48
  • \$\begingroup\$ doest that mean that i can use dot product to calculate a distance instead of using sqrt? \$\endgroup\$
    – Raildex
    Nov 13, 2020 at 18:22
  • \$\begingroup\$ @Raildex If you know in advance the direction you want to measure distance in, yes. You need to have already prepared a unit vector in that direction though; if you try to make a unit vector on the fly, that costs a sqrt anyway. But if you have such a perfectly-aligned unit vector set aside in advance, you've effectively precomputed the sqrt and cached the result so you don't have to re-compute it. \$\endgroup\$
    – DMGregory
    Nov 13, 2020 at 18:30
  • \$\begingroup\$ I have a camera direction vector and arbitrary positions of objects. instead of using Length(Object-Camera) I can use Dot(CameraDir,Object-Camera)? \$\endgroup\$
    – Raildex
    Nov 13, 2020 at 19:58
  • \$\begingroup\$ These two expressions are equivalent for objects on the direct line through the center of the camera's lens. But if the object is off to the side or a corner of the camera's view, then its separation vector isn't pointing fully in the same direction as CameraDir, so you would underestimate the diagonal distance to it by counting only the component parallel to the camera's axis and not the component perpendicular.. If you want a measure of "depth" from the camera though, like what's stored in a depth buffer, the dot product will get you that. \$\endgroup\$
    – DMGregory
    Nov 13, 2020 at 20:03

If the resulting scalar is 0; then it means the 2 vectors are perpendicular to each other (angle difference 90 degrees) . If the resulting scalar > 0; then the angle difference between them is less than 90 degrees. If the resulting scale is < 0; then the 2 vectors are facing opposite directions ( or angle difference > 90 degrees).

This can be useful in calculating backstabs for example. Or determine which quadrant one vector is relative to the other.

  • \$\begingroup\$ Is this true for non-normalized vectors? \$\endgroup\$
    – Steven
    Dec 17, 2014 at 3:11
  • \$\begingroup\$ Yes. More Characters. \$\endgroup\$
    – user55564
    Dec 17, 2014 at 3:20

the dot product is equal to v1.length() * v2.length() * dot(v1.normalized(), v2.normalized())

the most you can get out of that is whether the angle is acute or not or pass to other algorithms where you can delay the normalization. But you can get the normalized from the non-normalized by dividing with sqrt(v1.lengthSquared() * v2.lengthSquared()) (saves a sqrt calculation)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .