hinge compatibility algorithm