I agree with oliii's analysis, but also can't check the book immediately because it is at home while I am not.
Since you don't seem to be familiar with function pointers, at bit of a lesson..
To expand on what oliii said, those class members, Force and Torque, are function pointers that would have to be populated to be called. First, you'd either have to implement a
real function with the same prototype, or use one that Eberly provides. Lets say you right a function to generate a viscous damping force. It'd look like this. Note that the prototype matches *Function in the typedef:
Vector3 MyCalcConstantForce(Real time, Real mass, const Vector3& pos, const Quaterion& orient, const Vector3& linmom, const Vector3& angmom, const Matrix3& orientmat, const Vector3& linvel, const Vector3& angvel){ Vector3 DampingForce; float fDampingCoefficient = 0.1f; DampingForce = -linvel * fDampingCoefficient; return(DampingForce);}
Then to use it, lets say you have a rigid body "A":
RigidBody A;
A.Force = MyCalcConstantForce;
I'm assuming here that the Force member is public. But there must either be some way to set it, or it should be initialized by the physics system either in the constructor or at the top of the file if its a static member.
Once A.Force is set, other methods of A can call the function like so:
RigidBody::SomeFunction(){ if (0 != Force) { TotalForce += Force(time, mass, pos, orient, linmom, angmom, orientmat, linvel, angvel); }}
So, you can see that the function pointer data members in the RigidBody class allow you to substitute any number of different force/torque calculation functions. They get mapped to the data member name within the RigidBody class and can be called with the mapped data member name. Kind of cool and useful!
Graham Rhodes
Principal Scientist
Applied Research Associates, Inc.
[edited by - grhodes_at_work on April 23, 2004 9:48:51 AM]
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net