Discrete positions method in kinematics and control of spatial linkages