I'm going to use a specific example... which has always been upheld to be true here.
If I'm at home, and a neighbor comes to visit, and they ring the doorbell/knock, it has been stated that I am under no obligation to answer it if I do not choose to, and I am not rude to not choose to. That they can see me through the window is irrelevant. That they know I heard them is irrelevant. That I looked directly at them through the window and made eye contact is irrelevant. I don't recall that ever being supported here. As it's been repeatedly posited, just because I am greeted by invitation to interact (by knocking or doorbell), I am under absolutely no obligation to respond in kind. (If I'm misrepresenting this claim, I'd like to know... because I've read this time and time again.) You are under no obligation to answer the door or the telephone, the assumption being that the other person has no idea whether you're home or not. Gazing through the window and locking eyes with someone and then not answering the door is incredibly rude (unless it's a safety issue.
If that example above is rude, then it flies in the face of every unexpected-visitor-at-the-door thread I've ever read here. If that above example is not rude, then I don't see how being unexpectedly greeted on the street and not responding is.
I know that example isn't relevant to you, but the only difference is that in the first example, you're sitting on your couch, and in the second you're out and about. That's too slight a difference for me to be able to completely separate them. There is no "slight difference" when in your second example, the person is completely aware that you are ignoring him/her.
An invitation to interact is an invitation to interact, whether it's a ringing phone, a knocking door, or a cheery "Good morning!" from someone I wouldn't know from Adam. My being outside of my house gives me no special obligation to consent to conversation, beyond that which I am either literally obligated to (if I worked retail, I'd have to talk to customers), or that I choose to. Not everyone is a social butterfly. Clearly . . .
Some leave the house purely to go from point A to point B.
That said, I *do* sometimes accept interaction, and respond in kind. But I do so by choice, not because it's the only polite choice available to me.
Actually, the item bolded (that it's rude to not answer the door when the ringer
knows that you're home, and you know that they know), is wrong in traditional etiquette. Back when our current version of etiquette was being formed a caller could be told that "the lady of the house is not at home" even if they could see her puttering in the garden. This is no different; if someone doesn't answer the door, then they are "not at home". "Not at home" is the polite fiction to cover "doesn't want to see you right now."
Besides, someone peering in a window to see if someone is home is being rude in the first place. While I don't condone retaliatory rudeness, by doing this, they have disqualified themselves from anything but the absolute minimum of consideration. Having the door answered doesn't meet that level.