Motion Planning of N-joint Planar Mechanism: a Non-Heuristic Approach