Move kinematics implementation details to cpp file.

Defining things like d1 as macro is a VERY bad idea,
especially in a header.