1. iPhone and Processing is in same LAN of Wifi.
2. iPhone connects to Processing on Mac via Socket.
3. iPhone sends data from it’s rotation to Processing.
4. Processing draw x y z coordinate tracking.
This application is released on apple app store.
It's free application. Please check out it.
Have your fun!