Simulating and Generating Motions of Human Figures