dot product: FdotN = DotProduct(&curParticle->contactN,&curParticle->f);

Fractal Cat

New member
Joined
Dec 8, 2015
Messages
2
dot product: FdotN = DotProduct(&curParticle->contactN,&curParticle->f);

Hi,

I am trying to understand a piece of computer code that calculates the dot product of two vectors: the contact normal and the velocity of a particle.

// Calculating Magnitude of Fn

FdotN is the dot product of two vectors which I think are collinear. The first is the contact normal of a particle and the other is the velocity.

FdotN = DotProduct(&curParticle->contactN,&curParticle->f);

I don't understand what the components of the vectors in this code are. Can someone help?

FC.
 
I'm sorry, but I'm not entirely sure what you're asking. You have a line of C++ code where two arguments are passed to a function. Presumably, these two arguments are themselves objects of the vector class. So, what I understand your post to be asking is: "What are the vector components of these two vector objects that are being passed to the DotProduct function?" If that's the correct interpretation, then I don't think there's anyway for someone without access to the code to say. If you know how the vector class is coded, you could probably write a print statement to display the components of the vectors.
 
dot product

Hi,

In the following line of code I think that the first argument to the DotProduct function is a vector and it is called 'curParticle'. This vector also has a data structure inside it that is also a vector. There are two of these: one is the normal force (I guess called contactN) and the other is friction (I guess called 'f). But if that is the case, what are the contents of the components of these two vectors what do they represent?

// Calculate Magnitude of Fn
FdotN = DotProduct(&curParticle->contactN,&curParticle->f);

// Calculate Vt Velocity Tangent to Contact Normal
VdotN = DotProduct(&curParticle->contactN,&curParticle->v);
ScaleVector(&curParticle->contactN, VdotN, &Vn);
VectorDifference(&curParticle->v, &Vn, &Vt);

NormalizeVector(&Vt); // Get the Direction of Vt
// Multiply By Normal force magnitude and Coef of Kinetic Friction
ScaleVector(&Vt, (FdotN * m_Ckf), &Vt);

// Add into the Force Accumulator
VectorSum(&curParticle->f,&Vt,&curParticle->f);

Thanks

FC.
 
Top