The optimum distance someone walking in the opposite direction should be before one smiles at them. If too far, there is an awkward few metres trying to avoid eye contact, if too close they may think you are shunning them. Get this right, and stage one of rapport building is complete.
Person 1: Mate, I had a massively awkward moment the other day...
Person 2: What happened?
Person 1: Well, I saw this girl I know at the other side of the park coming toward me; naturally I smiled and waved.
Person 2: So, what was the problem?
Person 1: Well, she smiled back, but we were still separated by a good fifty metres. I didn't want to keep eye contact because that would have looked weird, and I could hardly smile again; I just had to look at the floor for a little while... Was so awkward...
Person 2: Ah I see, classic example of not leaving an appropriate greeting distance.