two-way shape matching