Kinematics of Spatial Linkages by Group Algebra: a Structure-Based Approach