Fixes a few typos/bugs in contact related files.

Fix bug in collisionDetectTerrain.m
Fix varargin usage in contactConstraintsBV
Fix definition of nk in contactConstraintsBV
Add check for mex pointer in collisionDetect

Also removes the ugly bit of code that called doKinematics with mex enabled if
the method received a kinsol with mex disabled. Now if the kinsol is non-mex or
if there is no mex pointer in the RBM, collisionDetect only performs collision
detection between elegible terrain contact points and the terrain.
add default implementation of RigidBodyTerrain.writeWRL method
Merge pull request #126 from avalenzu/collision-bug-fixes

Collision bug fixes