A surface integral approach to the motion planning of nonholonomic systems