Original Post
Hi again, thanks for the help you have given me so far.
I have yet another question
This is page 688 of the open gl game programming book.
In chapter 19, we have a mini game called air hockey.
One of the classes created is called Cpuck and has a function called animate.
In the animate function you loop through 4 Cplanes (walls around the hockey table) while testing for collision.
In the function you declare three variables of type double, a, b and c.
To these, you set them as:
double a, b, c;
// dot product - quadratic equation
a = plane->N % (acceleration * 0.5);
b = plane->N % velocity;
c = plane->N % position + plane->D - radius;
OK.
Are we saying that a is the “dot product” (this is according to the CVector operator overloading function we have set for the symbol %) of N and acceleration * 0.5 OR
Are we saying that a is the remainder after N (a vector) is divided by acceleration * 0.5?
Either way, the function I am thinking it is using in the CVector class accepts 2 CVectors as the argument:
const scalar_t operator%(const CVector &vec) const
{
return x*vec.x + y*vec.x + z*vec.z;
}
or am I totally thinking in the wrong way? To me that looks like it wants 2 CVec’s (according to what I have learned with operator overloading)
and returns a single value, which if I use some standard logic is like saying :
a = N.x*vec.x + N.y*vec.x + N.z*vec.z;
but what is vec.x, vec.y, vec.z? Where is the vector? Am I looking in the completely wrong spot? Please don’t make me realise something so obvious…
hmmm I hope I have made sense about my problem.
Im just a beginner!!!
http://www.actsofgord.com