I see. I thought NWW already had all the camera transformation code built-in.
I also had a lot of trouble with camera movement in my software, and the easiest way I found to handle those issues was to use quaternions. So, the camera is basically a gizmo with a view, up and the normal vector. The camera target is always at 0,0,0, which makes things easier. I assume the heading you mentioned is similar to my up vector. By implementing a quaternion class to handle the camera transformations, I was able to correct all my three vectors at every move.
Just had another look at that app and in fact it seems to be working alright (at least with the TUIO simulator), except that it doesn’t handle more than two fingers yet.
Let me know if you think this solution could be of any help, and I’ll give you some pointers. Although, I haven’t done much coding in the last 8 years, so don’t expect much.