Definition and validation of a distance measure between structural primitives