Refactor velocity constraint calculations in Ex 3.10.