Triangularization Kinematic Constraint Equations using Grobner Bases for Real-time Dynamic Simulation