A template-based approach for the specification of 3D topological constraints