# What Does Dot and Dot3 Mean In Math?

This topic is 3316 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'v been reading through my real time collision book, but I must have skipped a part, but I can't figure out what dot and dot3 does? I'm guesting to has to do with Matrix and Vectors? In a few examples it shows it returns a floating point number and the two parameters 1 is a floating point number and the second is a vector. I'm just curious if someone can throw one small example on usage and how to make my own Dot function. I'm not sure what the difference is between both Dot and Dot3. Thanks, Andrew.

##### Share on other sites
Dot product
Dot3 is an old technique for doing lighting on hardware that couldn't handle shaders. It's long dead at this point on almost everything.

##### Share on other sites
dot3 performs scalar multiplication of two vectors. The result is a scalar-number not a vector. this number equals :
dot3(A,B)= (vector A length)*(vector B length)*(cosinus of A-B vector angle).
so if you devide dot3 product by the vector lengths you get the angle cosine.
How else is angle between normal and light vectors found out theese days?
is there more fast way?

##### Share on other sites
Dot3 only emphasises the fact that it uses a 3-component vector. While nobody would probably unwittingly consider a 250-component vector, a 4-component vector might be tempting, as this is how points are usually defined. However, the dot product of a typical 4-component point (with w=1) will not give you what you would "normally" expect.

As it happens, 3-component vectors are the only thing that make sense for dot products in 3D, but in principle you could take the dot product of a 4-component(xyzw) vector or even a 250-component vector too. After all a dot product is only the sum of the product of its components, and kind of "measure of difference". Size-independent gesture recognition can be implemented that way very elegantly, to give one example.

The nice thing about dot products is that not only you can calculate the angle between vectors from it, use it for projecting one onto another, but you can also easily make rough facing decisions.
For example, you can for example say that if the dot product is greater than 0.5, then the vectors point "roughly into the same direction" (in the case of 0.5, there's less than 60 degrees between them).

##### Share on other sites
Quote:
 Original post by samothFor example, you can for example say that if the dot product is greater than 0.5, then the vectors point "roughly into the same direction" (in the case of 0.5, there's less than 60 degrees between them).

You should explicitly add "if the two vectors are unit-length(ed?)": ajm113 may be confused by that implicit assumption.

To ajm113:
Basically, when we apply scalar multiplication to two vectors, we multiply the length of, let's say the first one, by the length of the projection of the second one into the first...A good sketching would fully show what I mean.

So in dot( v1, v2 ) = length( v1 ) * length( v2 ) * cos( angle( v1, v2 ) ), the part length( v2 ) * cos( angle( v1, v2 ) ) is the length of the projection of v2 into( onto? ) v1. That is why we use scalar product when we want to know the components of a vector in a specified orthonormal basis into another orthonormal basis.( particular case )

Basically, the x-component of a vector v, is simply the length of the projection of vector v into the x-axis, when of course, the x-axis is unit-length.

v = (vx,vy,vz )

=>

vx = dot( v, x-axis )
vy = dot( v, y-axis )
vz = dot( v, z-axis )

You need to visualize what a scalar product is, to fully understand its meaning. I hope that I helped.

##### Share on other sites
Ok, I have more of a understanding of how it works johnstanp. I'm just not sure if I have it right, I tried your method, but I kept getting 0.

First thing is I want to make sure is that I have my length function right.

float GetVector3Length(Vector3 vec3){	float vf = 0;	float parm = vec3.m_fX * vec3.m_fY * vec3.m_fZ + vec3.m_fX * vec3.m_fY * vec3.m_fZ;parm = parm * parm;vf = sqrt( parm );return vf;}

I'm new to geometry so I'm a bit confused on some words.

##### Share on other sites
Quote:
 Original post by ajm113Ok, I have more of a understanding of how it works johnstanp. I'm just not sure if I have it right, I tried your method, but I kept getting 0.First thing is I want to make sure is that I have my length function right.*** Source Snippet Removed ***I'm new to geometry so I'm a bit confused on some words.

No, that's not right. It's:

length = sqrt(x * x + y * y + z * z);

##### Share on other sites
Hey, thanks! I got it working, thanks for your guys help! :)

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
17
5. 5

• 9
• 12
• 9
• 33
• 13
• ### Forum Statistics

• Total Topics
632593
• Total Posts
3007266

×